我尝试调用作为 CRM4 的一部分部署的自定义 Web 服务并收到以下错误:
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
<title>No Microsoft Dynamics CRM user exists with the specified domain name and user ID</title>
<style>
...
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/RecurrenceService' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>No Microsoft Dynamics CRM user exists with the specified domain name and user ID</i> </h2></span>
...
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
[CrmException: No Microsoft Dynamics CRM user exists with the specified domain name and user ID]
Microsoft.Crm.Authentication.WindowsAuthenticationProvider.Authenticate(HttpApplication application) +895
Microsoft.Crm.Authentication.AuthenticationStep.Authenticate(HttpApplication application) +125
Microsoft.Crm.Authentication.AuthenticationPipeline.Authenticate(HttpApplication application) +66
Microsoft.Crm.Authentication.AuthenticationEngine.Execute(Object sender, EventArgs e) +513
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
</font>
</body>
</html>
<!--
[CrmException]: No Microsoft Dynamics CRM user exists with the specified domain name and user ID
at Microsoft.Crm.Authentication.WindowsAuthenticationProvider.Authenticate(HttpApplication application)
at Microsoft.Crm.Authentication.AuthenticationStep.Authenticate(HttpApplication application)
at Microsoft.Crm.Authentication.AuthenticationPipeline.Authenticate(HttpApplication application)
at Microsoft.Crm.Authentication.AuthenticationEngine.Execute(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
--.
调用我的网络服务的代码:
RecurrenceService serv = new RecurrenceService();
serv.Credentials = System.Net.CredentialCache.DefaultCredentials;
string result = serv.UpdateSeries();
CRM4 网址:http://cw-dev-5/loader.aspx
定制服务网址:http://cw-dev-5/RecurrenceService/RecurrenceService.asmx
以下代码片段System.Security.Principal.WindowsIdentity.GetCurrent().Name
返回NT AUTHORITY\NETWORK SERVICE
(我想这是错误的原因)
有人可以建议我解决我的问题吗?