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.
- <
- binding name="QueryServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
- receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
- bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
- maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
- messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
- useDefaultWebProxy="true">
- <
- readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
- maxBytesPerRead="4096" maxNameTableCharCount="16384"
- />
- < security mode="Transport" >
- < transport clientCredentialType="None" proxyCredentialType="None" realm="" />
- < message clientCredentialType="UserName" algorithmSuite="Default" />
- < security />
- < 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.
- <security mode="Transport">
- <transport clientCredentialType="Ntlm" />
- </security>