访问WebService中的方法失败,捕获的异常是“Server was unable to process request”和“The user Id is invalid.”谢谢大家了。

zorroonline 2006-03-02 02:05:36
访问WebService中的方法失败,捕获的异常是“Server was unable to process request”和“The user Id is invalid.”请问是什么原因呀,谢谢。

CrmService objService = new CrmService();
objService.Url = "http://10.100.0.100:5555/MSCRMServices/Service.asmx";
System.Net.NetworkCredential objNetCredential = new System.Net.NetworkCredential();
objNetCredential.UserName = @"Test\Administrator";
objNetCredential.Password = "123";
objService.Credentials = objNetCredential;
...全文
850 14 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
zorroonline 2006-04-20
  • 打赏
  • 举报
回复
问题没有解决
zorroonline 2006-03-02
  • 打赏
  • 举报
回复
为什么是namespace的问题
zorroonline 2006-03-02
  • 打赏
  • 举报
回复
谢谢,我试试,回头给你分
开发者开聊 2006-03-02
  • 打赏
  • 举报
回复
估计是namespace的问题
Overriding 2006-03-02
  • 打赏
  • 举报
回复
1> 我的webservice根目录属性-Directory Security-Edit-Integrated Windos Authentication选中
2>web.config文件里设置<authentication mode="Windows"/>
3>ws代码

[WebMethod]
public string HelloWorld() {
return "Hello World";
}
4>调用代码
private void button1_Click(object sender, EventArgs e)
{
sss.Service s = new sss.Service();
s.Credentials = new NetworkCredential("FAREAST\v-zzhao", "xxxxxx.");
MessageBox.Show( s.HelloWorld());
}
结果正确
zorroonline 2006-03-02
  • 打赏
  • 举报
回复
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/>
</configSections>
<connectionStrings>
<add name="MRDataAccess" connectionString="server=10.100.0.194;database=dev0SCR_CRM;uid=sa;pwd=sql2005" providerName="System.Data.SqlClient"/>
<add name="dev0SCR_CRMConnectionString1" connectionString="Data Source=10.100.0.194;Initial Catalog=dev0SCR_CRM;Persist Security Info=True;User ID=sa;MultipleActiveResultSets=False;Packet Size=4096;Application Name="Microsoft SQL Server Management Studio"" providerName="System.Data.SqlClient"/>
</connectionStrings>
<dataConfiguration defaultDatabase="MRDataAccess"/>
<cachingConfiguration defaultCacheManager="Default Cache Manager">
<backingStores>
<add name="inMemory" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching"/>
</backingStores>
<cacheManagers>
<add name="Default Cache Manager" expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="inMemory"/>
</cacheManagers>
</cachingConfiguration>
<appSettings>
<add key="CrmService" value="http://10.100.0.151:5555/MSCRMServices/2006/CrmService.asmx"/>
</appSettings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
Overriding 2006-03-02
  • 打赏
  • 举报
回复
还有把你的域去掉
Overriding 2006-03-02
  • 打赏
  • 举报
回复
web.config文件贴出来。
zorroonline 2006-03-02
  • 打赏
  • 举报
回复
是的 ,是域
Overriding 2006-03-02
  • 打赏
  • 举报
回复
Test是你的域吗?
zorroonline 2006-03-02
  • 打赏
  • 举报
回复
是的
Overriding 2006-03-02
  • 打赏
  • 举报
回复
你的webservice用的windows集成身份验证?
zorroonline 2006-03-02
  • 打赏
  • 举报
回复
函数类型正确
是不是因为一些验证的事情
supesa 2006-03-02
  • 打赏
  • 举报
回复
查查你Service.asmx中调用的函数类型是否正确?

12,166

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧