[英]'System.ServiceModel.Security.MessageSecurityException' in WCF
I have WCF client with the following config. 我有带有以下配置的WCF客户端。
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="MyService" 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="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://myservername/MyGreatServices/MyService.svc" binding="basicHttpBinding" bindingConfiguration="MyService" contract="XXX.Ixxx" name="MyService" /> </client> </system.serviceModel>
but when trying to run application getting an error: 但是当尝试运行应用程序时出现错误:
An exception of type 'System.ServiceModel.Security.MessageSecurityException' occurred in mscorlib.dll but was not handled in user code Additional information: The HTTP request is unauthorized with client authentication scheme 'Negotiate'.
mscorlib.dll中发生类型'System.ServiceModel.Security.MessageSecurityException'的异常,但未在用户代码中处理。其他信息:HTTP请求未经客户端身份验证方案'Negotiate'的授权。 The authentication header received from the server was 'Negotiate oXoweKADCgEBonEEb2BtBgkqhkiG9xIBAgIDAH5eMFygAwIBBaEDAgEepBEYDzIwMTYwMTEyMjAwNDAwWqUFAgMH13imAwIBKakUGxJVUy5LV09STEQuS1BNRy5DT02qGzAZoAMCAQGhEjAQGw51c21kY2tkYXAxMDg3JA=='.
从服务器接收到的认证标头是“协商oXoweKADCgEBonEEb2BtBgkqhkiG9xIBAgIDAH5eMFygAwIBBaEDAgEepBEYDzIwMTYwMTEyMjAwNDAwWqUFAgMH13imAwIBKakUGxJVUy5LV09STEQuS1BNRy5DT02qGzAZoAMCAQGhEjAQGw51c21kY2tkYXAxMDg3JA ==”。
On the IIS both Anonimous and Windows authentication are enabled 在IIS上,同时启用了Anonimous和Windows身份验证
change 更改
<transport clientCredentialType="Windows" />
to 至
<transport clientCredentialType="Ntlm" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.