Today, I wrote a unit test to consume one web service method
and I got the following error.
The HTTP request is
unauthorized with client authentication scheme 'Anonymous'. The authentication
header received from the server was 'NTLM'.
After looking into this
issue, in app.config , it uses security mode =None and clientCredentialType =None.
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
After using the
following code, everything is working perfectly.
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>