Fixing SharePoint Web Service Binding Issue

The issue is:

"The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'."

Sometime when we hit SharePoint web services hosted on NTLM and then it will throw exception "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate, NTLM'."

When you add SharePoint web service reference, it will add below binding info by default.

  1. <  
  2.    binding name="QueryServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"  
  3.    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"  
  4.    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"  
  5.    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"  
  6.    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"  
  7.    useDefaultWebProxy="true">
  8. <  
  9.    readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"  
  10.    maxBytesPerRead="4096" maxNameTableCharCount="16384" 
  11. />  
  12. security mode="Transport" >  
  13. transport clientCredentialType="None" proxyCredentialType="None" realm="" />  
  14. < message clientCredentialType="UserName" algorithmSuite="Default" />  
  15. security />  
  16. < binding />  
And when we hit any web service method with above binding , it will gave us an exception as below:

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'."

In order to fix issue, you just need to modify Security node on client side as below, and this may fix above issue.
  1. <security mode="Transport">  
  2.    <transport clientCredentialType="Ntlm" />  
  3. </security>  

Ebook Download
View all
Learn
View all