本地运行正常,部署到IIS上时,关于调用webservices的方法抛出异常!!!
异常信息: 'The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'.'
IIS上部署项目,运行项目中调用了webservices相关方法时抛出上面的异常。在本地运行没有任何问题。
<security mode="Transport">
<transport clientCredentialType="Ntlm" />
</security>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
这个是config文件的配置。
[解决办法]
这个试过吗?
cl.Credentials = System.Net.CredentialCache.DefaultCredentials;