0

我使用带有自定义用户名验证 x.509 但没有 SSL 的 wsHttpBinding 为客户端设置了 WCF 服务

他们使用的是 PHP,完全无法通过 WS 安全性,所以我们的解决方案必须是添加另一个基本的 httpbinding。但是当我这样做时,它似乎需要 SSL。我的要求是绝对不要使用 SSL。

我的 wshttpbinding 看起来像这样:

<wsHttpBinding>
    <binding name="WSHttpBinding_ISearchService" closeTimeout="00:10:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="true" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
      <security mode="Message"  >
        <message clientCredentialType="UserName"/>
      </security>
    </binding>

<serviceBehaviors>
    <behavior name="My.Services.SearchServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />

      <dataContractSerializer maxItemsInObjectGraph="2147483647" />

      <serviceCredentials>
        <serviceCertificate findValue="01000000000xxxxxxxxx" storeLocation="LocalMachine"
                                 storeName="My" x509FindType="FindBySerialNumber" />
        <userNameAuthentication userNamePasswordValidationMode="Custom"
         customUserNamePasswordValidatorType="My.Services.UserNamePassValidator, SearchService" />
      </serviceCredentials>

    </behavior>
  </serviceBehaviors>

在没有 SSL 的情况下使用 basichttpbinding 可以实现相同的精确配置吗?

4

1 回答 1

0

BasicHttpBinding 要求 BasicHttpBinding.Security.Message.ClientCredentialType 等效于安全模式“Message”的 BasicHttpMessageCredentialType.Certificate 凭证类型。所以首先你不能使用 clientCredentialType="UserName"。
您需要有客户端证书来加密消息和传输。WCF SDK 示例实现了一种这样的场景,请在此处查看

于 2011-04-28T16:21:24.250 回答