RSS

CRM 2011 Exception “The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘NTLM'”

08 Nov

Introduction

This is in reference to my previous post Calling external Web Service from a CRM 2011 Plug-in. This blog post is just a modification of the last post.

Background

In one of the project while calling an external Web Service hosted in some other server(other than CRM server), I found an issue like the one below.

” The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘NTLM’ “

Problem

Clearly its an Authentication Issue. Then I found out that in Authentication Section of IIS, the Authentication Scheme for the service was Ntlm, whereas I was using Default Authentication Scheme in my HTTP Binding inside Configuration Information.

Solution

Instead of using the Default Authentication, I changed my Binding to use Ntlm Authentication.

So, instead of the following code,

BasicHttpBinding myBinding = new BasicHttpBinding();

myBinding.Name = "BasicHttpBinding_Service";
myBinding.Security.Mode = BasicHttpSecurityMode.None;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

I changed my code like below…

BasicHttpBinding myBinding = new BasicHttpBinding();

myBinding.Name = "BasicHttpBinding_Service";
myBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

And to my utter surprise, it started to work :). !!!

By Dibyasingh Tripathy
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

Advertisements
 

Tags: , , , , , , , , , , , , , , , ,

2 responses to “CRM 2011 Exception “The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘NTLM'”

  1. Sistema de CRM

    November 14, 2013 at 7:07 pm

    Very good CRM tip. Martins, Jose Carlos – It Consultant.

     
  2. DynamicsCRM@MindfireSolutions

    November 19, 2013 at 5:41 am

    Thanks Jose!!!

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: