使用本地系统帐户从 Windows 服务通过集成 Windows 身份验证访问 WCF 服务

发布于 2024-08-21 12:36:14 字数 1470 浏览 6 评论 0原文

我们在专用服务器上部署了使用集成 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文