繁体   English   中英

从插件调用自定义Web服务时出错

[英]error at calling custom web service from plugin

我尝试调用作为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)
        -->
        --.

调用我的Web服务的代码:

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 (我想这是错误原因)

有人可以建议我任何解决方案吗?

如果您的CRM服务器上有多个组织,则需要在URL中输入组织名称:

http://cw-dev-5/SomeOrgName/RecurrenceService/RecurrenceService.asmx

如果Web应用程序位于CRM网站中,则必须执行此操作,因为CRM将对用户进行身份验证,并查看用户是否存在于该组织中。 如果您不使用该组织,它将使用默认组织。

这是一些有关MSDN工作原理的文档: 使用Microsoft Dynamics CRM URL

这是从ASP.Net网站调用吗? 您可能需要将应用程序池标识更改为有权访问CRM站点的域用户(当前正在尝试使用NT AUTHORITY \\ NETWORK SERVICE)

是正在调用CRM服务的Web服务

自定义服务网址:“ http://cw-dev-5/RecurrenceService/RecurrenceService.asmx

需要按照CRM用户admin中设置的crm用户身份登录。

如果您是通过插件调用的,则也必须是在CRM中具有用户设置的身份

也许您正在运行非英语的操作系统?

无论出于何种原因,在将操作系统翻译成其他语言时,有时都会本地化网络服务的登录名。

现在,许多程序希望将登录名硬编码为“ NT AUTHORITY \\ NETWORK SERVICE”-例如在德语版本的Windows中,帐户名称为“NT-AUTORITÄT\\ NETZWERKDIENST”。 因此,您的程序正在寻找英文名称,找不到它,并显示错误。

不知道这是否适用于您的问题,但可能值得检查!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM