我从控制台应用程序调用WCF服务,我对WCF服务没有任何控制权。
此控制台应用在我的开发系统和一台2008服务器上正常工作,当我将其移至运行Windows 2012的服务器时,它会出错 HTTP请求未经授权使用客户端身份验证方案'协商”。从服务器收到的身份验证标头是“Negotiate,NTLM”
app配置文件包含
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceNameSoap" maxBufferSize="5242880" maxReceivedMessageSize="5242880">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://someCompanyurl.com/ServiceName" binding="basicHttpBinding" bindingConfiguration="ServiceNameSoap" contract="ServiceName.ServiceNameSoap" name="ServiceNameSoap"/>
</client>
实际代码是
ServiceNameSoapClient proxy = new ServiceNameSoapSoapClient();
proxy.ClientCredentials.Windows.ClientCredential.Domain = connStringParts[DOMAIN];
proxy.ClientCredentials.Windows.ClientCredential.UserName = connStringParts[USER_NAME];
proxy.ClientCredentials.Windows.ClientCredential.Password = connStringParts[PASSWORD];
proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;
RequestHeader soapHeader = new RequestHeader();
soapHeader.clientApplicationName = ConfigurationManager.AppSettings["clientApplicationName"];
ServiceNameRequestCollection request = new ServiceNameRequestCollection();
adding some flags to request
Response = proxy.Method(soapHeader, request, out Response);
我进行了广泛的搜索,并没有喜欢任何解决方案。
2012服务器上缺少任何设置或配置缺失?
尝试将 Ntlm更改为Windows ,反之亦然。同样的错误,在错误消息中协商对ntlm的更改。
谢谢