Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Issue when invoking SOAP WCF web service from plugin Dynamics CRM 365

Posted on by 30

Hello

I get this message bellow infrequently when I invoke web service in crm plugin after creating or updating record.

Unexpected exception from plug-in (Execute): System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'

this is my web server binding configuration

<bindings>
        <basicHttpsBinding>
            <binding>
                <security mode="Transport">
                    <transport clientCredentialType="Windows">
                        <extendedProtectionPolicy policyEnforcement="Always"></extendedProtectionPolicy>
                    </transport>
        <message clientCredentialType="UserName"/>
                </security>
            </binding>
        </basicHttpsBinding>
    </bindings>

And I called it from plugin :

BasicHttpsBinding binding = new BasicHttpsBinding();
binding.Name = "BasicHttpsBinding_IServiceIntegration";
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

binding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Windows;
binding.Security.Mode = BasicHttpsSecurityMode.Transport;

EndpointAddress myEndpoint = new EndpointAddress("https://myurlwebservice/ServiceIntegration.svc");
ServiceClient = new ServiceIntegrationClient(binding, myEndpoint);

ServiceClient.ClientCredentials.Windows.ClientCredential.Domain = "domain";
ServiceClient.ClientCredentials.Windows.ClientCredential.UserName = "user name";
ServiceClient.ClientCredentials.Windows.ClientCredential.Password = "password";

The IIS server configuration

21_2D00_03_2D00_2018-11_2D00_01_2D00_53.png


Thanks in advance

*This post is locked for comments

  • srknhcgl Profile Picture
    srknhcgl 2 on at
    Issue when invoking SOAP WCF web service from plugin Dynamics CRM 365
    you are setting basicHttpsBinding/clientCredentialType="UserName" and binding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Windows;
    basic authentication and windows authentication are two different things.
  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Issue when invoking SOAP WCF web service from plugin Dynamics CRM 365

    Hi BEN,

    Could you please check below references - may be your issue will resolve.

    blogs.msdn.microsoft.com/.../wcf-calling-wcf-service-hosted-in-iis-on-the-same-machine-as-client-throws-authentication-error

    stackoverflow.com/.../the-http-request-is-unauthorized-with-client-authentication-scheme-negotiate

    Hope this helps . Good luck.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans