WCF CustomBinding Duplex无法打开客户端端口

时间:2010-07-29 21:44:28

标签: c# wcf authentication encoding binding

我正在努力使用这种双工WCF服务,该服务调用服务来获取大量数据。 我正在使用wsDualHttpBinding工作,但速度很慢。我描述了序列化程序和身份验证过程正在使用大部分时间。所以我决定使用二进制编码并将安全性更改为传输,因为它是一个内部网应用程序,所以加密并不是必需的。

<wsDualHttpBinding>
        <binding name="CRMXServiceDualBinding" sendTimeout="00:10:00"
          maxBufferPoolSize="50524288" maxReceivedMessageSize="50000000"
          messageEncoding="Mtom">
          <readerQuotas maxDepth="50000000" maxStringContentLength="50000000"
            maxArrayLength="50000000" maxBytesPerRead="50000000" maxNameTableCharCount="50000000" />
          <reliableSession ordered="true" inactivityTimeout="00:30:00" />
          <security mode="Message">
            <message clientCredentialType="Windows" negotiateServiceCredential="true" />
          </security>
        </binding>
      </wsDualHttpBinding>

所以我尝试编写这个自定义绑定。

<customBinding>
        <binding name="DuplexBindingConfig">
          <compositeDuplex />
          <oneWay maxAcceptedChannels="128" packetRoutable="false">
            <channelPoolSettings idleTimeout="00:10:00" leaseTimeout="00:10:00"
              maxOutboundChannelsPerEndpoint="10" />
          </oneWay>
          <binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
              maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </binaryMessageEncoding>
          <httpTransport manualAddressing="false" maxBufferPoolSize="2147483647"
            maxReceivedMessageSize="2147483647" allowCookies="false" authenticationScheme="Negotiate"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            keepAliveEnabled="true" maxBufferSize="2147483647" proxyAuthenticationScheme="Anonymous"
            realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
            useDefaultWebProxy="true" />
        </binding>
      </customBinding>

现在我面临两个问题: 1.要在ASP.Net开发服务器上测试,它会立即返回错误: “HTTP请求未经授权,客户端身份验证方案'Negotiate'。从服务器收到的身份验证头是'NTLM'。” 2.在IIS6上测试,呼叫永远不会到达服务器。 我的预感是没有打开客户端端口。

请帮助..提前致谢。

* BTW我正在使用Windows XP SP3,Framework 3.5 SP1,VS2008

1 个答案:

答案 0 :(得分:4)

我可以看到一个问题:

您无法在双工http绑定上使用传输级别安全性,甚至是自定义双工http绑定。

客户端将侦听通用端口侦听器(即不是Web服务的侦听器),并且不会理解使SSL工作所需的详细信息。

相关问题