【问题标题】:BasicHttpBinding with TransportWithMessageCredential and clientCredentialType="Windows"带有 TransportWithMessageCredential 和 clientCredentialType="Windows" 的 BasicHttpBinding
【发布时间】:2012-07-16 10:05:16
【问题描述】:

我在客户端和服务器上使用这个绑定配置:

<basicHttpBinding>
    <binding name="BasicHttpBinding_IService1">
        <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="Windows" />
        </security>
    </binding>
</basicHttpBinding>

客户端凭据似乎不是像我假设的那样自动传递(或者它们是?),所以我需要知道如何自己设置它们。这还能用吗?

【问题讨论】:

    标签: wcf windows-authentication basichttpbinding


    【解决方案1】:

    您必须在 IIS 上启用 Windows 身份验证。请查看以下链接以了解如何操作。

    另外,我查看了MSDN 网站,您的配置和 msdn 之间的关键区别在于安全模式

    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    

    如您所见,唯一的区别是模式。我不确定这是否会解决您的问题,但请试一试。

    以下是所有“服务绑定”中的 5 种可能的“安全模式”。

    - 关闭安全性。

    传输 - 使用“传输安全”进行相互身份验证和消息保护。

    消息 - 使用“消息安全”进行相互身份验证和消息保护。

    两者 - 允许您提供传输和消息级安全设置(只有 MSMQ 支持此设置)。

    TransportWithMessageCredential - 凭据与消息一起传递,并提供消息保护和服务器身份验证 由传输层。

    TransportCredentialOnly - 客户端凭据通过传输层传递,不应用任何消息保护。

    【讨论】:

    • 我已经在 IIS 中激活了 Windows Auth。我什至无法将服务引用添加到这样配置的 WCF 服务中。
    • 如果您将我们的服务配置为使用 BasicHttpBinding,您将无法添加服务引用,因为通过使用此绑定,您实际上并没有使用 SOAP。对于非基于肥皂的服务,您不能生成元数据
    • 我已经使用BasicHttpBinding添加了几十个服务引用,我真的看不到这里的问题。
    • 如果您无法使用“添加服务参考”添加服务,您可能没有通过身份验证?您是否为服务器和客户端添加了证书?
    【解决方案2】:

    我发现此行为的原因是我必须重新启用的错误 ASP.NET 4 安装。之后它“就可以工作了”。

    http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-02
      • 1970-01-01
      • 2011-05-27
      相关资源
      最近更新 更多