使用本地系统帐户从 Windows 服务通过集成 Windows 身份验证访问 WCF 服务
我们在专用服务器上部署了使用集成 Windows 身份验证的 WCF 服务。 客户端计算机上将有 Windows 服务[Windows 服务使用本地系统帐户]。当 Windows 服务中的 WCFServiceClient 访问 WCF 服务时,我们会收到错误。[如果 Windows 服务位于服务器计算机上,则可以正常工作]
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
我们不能允许匿名访问或无法从 WCF 服务中删除 Windows 身份验证。有没有办法解决这个问题。
客户端的配置是
<basicHttpBinding>
<binding name="BasicServiceHttpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
服务器配置是
<basicHttpBinding>
<binding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
/binding>
</basicHttpBinding>
We have WCF service using Integrated windows authentication deployed on a dedicated server.
There will be Windows Service on Client machines[windows service uses Local System Account].We get an error when the WCFServiceClient in Windows service accesses the WCF service.[If windows service is on server machine it works fine]
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
We cannot allow anonymous access or can not remove windows authentication from WCF service. Is there a way to get around this problem.
The config on client side is
<basicHttpBinding>
<binding name="BasicServiceHttpBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
The server config is
<basicHttpBinding>
<binding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
/binding>
</basicHttpBinding>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论