WCF 在 2012 R2 服务器拒绝使用来自客户端的凭据进行基本 http 绑定



我偶然发现了一个大问题。服务器端在 .net 上运行,在传输级别具有基本安全性上的 basicHttpBinding。所以我们来了:

Server web.config (IIS 基本身份验证 = ON,所有其他 = 关闭,协议 = HTTP):

<basicHttpBinding>
      <binding maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed" messageEncoding="Text">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>
  </basicHttpBinding>

在客户端中,我们有相同的基本HttpBinding。

App.exe.config:

<basicHttpBinding>
    <binding name="Default" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" transferMode="StreamedResponse" maxBufferPoolSize="524288000" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="65536000" maxArrayLength="65536000" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
            <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Basic" />
            </security>
    </binding>
</basicHttpBinding>

另外,我碰巧知道在Windows 8.1和服务器2012 R2中,basicHttpBinding方法仅限于传输凭据。所以问题是我有什么选择?我可以避免通过 https 使用 SSL 吗?如果没有,那么我的配置应该如何查找两端都有 wsHttpBinding 的 https?任何帮助感谢!!

好的,你应该改变这一行:

<transport clientCredentialType="Basic" />

<transport clientCredentialType="Windows" />

将传输安全与基本 HTTP 绑定配合使用。此链接详细介绍了如何在 IIS 中配置服务的分步说明

最新更新