我正在尝试从我们的办公室共享点调用网络服务。当我从我们的测试项目中调用它并且我可以访问 url 并通过浏览器检索信息时它起作用但是当我通过网络服务调用它时我收到以下错误:
System.ServiceModel.Security.MessageSecurityException:HTTP 请求未经客户端身份验证方案“协商”授权。从服务器收到的身份验证 header 是 'Basic realm=
当我们登录到 Sharepoint 时,我们使用我们的 Windows 凭据自动登录。
我的网络配置如下所示:
<binding name="ListsSoap" 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="Windows" proxyCredentialType="Basic" realm="" />
<message
clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
该 url 使用 SSL(即 https://blahblah.com.sharepoint.emea.microsoftonline.com/Lists/ ....)
我几乎使用了所有组合:使用 ntlm 进行传输,使用 basic 进行 TransportWithMessageCredential 等,我要么收到错误消息,提示它需要 http,但得到的是 https。
感谢帮助
E
最佳答案
您的客户端和服务器正在使用不同的身份验证方案。服务器使用“基本身份验证”,而您的客户端使用“协商”,我猜这是 Windows 身份验证。
关于c# - HTTP 请求未经客户端身份验证方案 'Negotiate' 授权。身份验证 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7703587/