【问题标题】:What is the correct WCF net.tcp binding security for this scenario?这种情况下正确的 WCF net.tcp 绑定安全性是什么?
【发布时间】:2011-03-10 17:51:50
【问题描述】:

我有一个 WCF 服务,它托管在 Windows 服务中,并且有 net.tcp 端点。客户端与服务位于同一 LAN(工作组)中,但它们没有服务器的 Windows 用户帐户。

PS:当我在客户端和服务器中将 Security.Mode 设置为 None 时,我收到以下错误:

不支持请求的升级 by '{SERVICE ADDRESS}' 这可能是由于不匹配 绑定(例如启用安全性 在客户端而不是在服务器上)。

【问题讨论】:

    标签: wcf wcf-binding nettcpbinding


    【解决方案1】:

    默认情况下,Nettcp 绑定是安全,您的客户端必须提供 Windows 凭据,因为所有消息都通过 tcp 签名和加密。将其设置为 none 可能会导致问题,你会想要这样的:

    <netTcpBinding>
         <binding name="netTcp">
           <security mode="Transport">
             <transport clientCredentialType="Windows" />
           </security>
         </binding>
    </netTcpBinding>
    

    【讨论】:

    • 感谢您的回复。但正如我提到的,客户端没有服务器中可用的用户帐户,因此 Windows 身份验证将失败。我尝试将 client.ClientCredentials.Windows.ClientCredential 用户名和密码设置为服务器的管理员用户,但没有运气,它仍然失败。
    【解决方案2】:

    好的,我解决了这个问题。

    我不知道为什么会这样,但是如果我在服务器的文件夹选项中取消选中“使用简单文件共享”,一切正常。

    【讨论】:

      【解决方案3】:

      我有自托管的 net.tcp 服务,无论有无安全,它们都可以正常工作,事实上,您可以在同一个端口上托管多个安全和不安全的 net.tcp 合约,这使得防火墙设置更简单。

      如果关闭简单文件共享是允许您的客户端/服务工作的原因,那么我怀疑您选择托管服务的端口也被简单文件共享使用。

      【讨论】:

        【解决方案4】:

        如果上述任何解决方案都不适合您,请尝试从您的端点删除身份,如下所示:

        <endpoint address="net.tcp://127.0.0.1/FacilitySchedulesService/FacilitySchedulesService.svc"
                        binding="netTcpBinding" bindingConfiguration="FacilityScheduleDSTCP"
                        contract="FacilitySchedules.IFacilitySchedulesService" name="FacilityScheduleDSTCP">
                <!--<identity>
                  <userPrincipalName value="abc" />
                </identity>-->
              </endpoint>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-05-14
          • 1970-01-01
          • 1970-01-01
          • 2018-05-03
          • 1970-01-01
          • 1970-01-01
          • 2013-04-23
          • 2011-03-26
          相关资源
          最近更新 更多