简体   繁体   中英

error at calling custom web service from plugin

I try to call my custom web service which is deployed as part of CRM4 and received the following error:

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)
        -->
        --.

Code for calling my web service:

RecurrenceService serv = new RecurrenceService();
serv.Credentials = System.Net.CredentialCache.DefaultCredentials;
string result = serv.UpdateSeries();

CRM4 url: http://cw-dev-5/loader.aspx

Custom service url: http://cw-dev-5/RecurrenceService/RecurrenceService.asmx

The following code snippet System.Security.Principal.WindowsIdentity.GetCurrent().Name returns NT AUTHORITY\\NETWORK SERVICE (I suppose it's a cause of error)

Could someone suggest me any solution to resolve my issue?

If your CRM server has multiple orgs on it, you'll need to put the org name in your URL:

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

You have to do this if the web application is in the CRM website because CRM will authenticate the user and see if they exist in that org. If you leave the org off, it uses the default org.

Here's some MSDN documentation on how that works: Using Microsoft Dynamics CRM URLs .

Is this calling it from an ASP.Net site? You may need to change the application pool identity to a domain user that has access to the CRM site (it's currently trying to use NT AUTHORITY\\NETWORK SERVICE)

yep the webservice that is calling the CRM Services

custom service url: " http://cw-dev-5/RecurrenceService/RecurrenceService.asmx "

That needs to be logged on as a crm user as set up in the CRM user admin.

If you are calling from a plugin - that too needs to be the identity which has a user setup in CRM

Maybe you are running a non-english operating system?

Somehow, for whatever reasons, the login name for the network service is sometimes localized when the OS is translated into other languages.

Now a lot of programs expect the login name to be hard coded to "NT AUTHORITY\\NETWORK SERVICE" - in a German version of Windows for example the name of the account is "NT-AUTORITÄT\\NETZWERKDIENST". So your program is looking for the english name, can't find it, and shows an error.

Not sure if this applies to your problem, but it might be worth checking!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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