【问题标题】:error at calling custom web service from plugin从插件调用自定义 Web 服务时出错
【发布时间】:2009-02-13 12:24:52
【问题描述】:

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

下面的代码 sn -p System.Security.Principal.WindowsIdentity.GetCurrent().Name 返回NT AUTHORITY\NETWORK SERVICE (我想这是错误的原因)

有人可以建议我解决我的问题吗?

【问题讨论】:

    标签: c# web-services dynamics-crm-4 crm


    【解决方案1】:

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

    【讨论】:

    • 我尝试从插件调用我的服务。
    【解决方案2】:

    是的,是调用 CRM 服务的网络服务

    定制服务网址: "http://cw-dev-5/RecurrenceService/RecurrenceService.asmx"

    这需要以 CRM 用户管理员中设置的 crm 用户身份登录。

    如果您从插件调用 - 这也需要是在 CRM 中具有用户设置的身份

    【讨论】:

      【解决方案3】:

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

      不知何故,当操作系统被翻译成其他语言时,网络服务的登录名有时会被本地化。

      现在很多程序都希望将登录名硬编码为“NT AUTHORITY\NETWORK SERVICE”——例如,在德语版本的 Windows 中,帐户的名称是“NT-AUTORITÄT\NETZWERKDIENST”。所以你的程序在找英文名,找不到,报错。

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

      【讨论】:

        【解决方案4】:

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

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

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

        这里有一些 MSDN 文档说明它是如何工作的:Using Microsoft Dynamics CRM URLs

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-07-13
          • 2016-01-25
          • 1970-01-01
          相关资源
          最近更新 更多