gpt4 book ai didi

c# - WCF CustomBinding Duplex 无法打开客户端端口

转载 作者:行者123 更新时间:2023-11-30 21:20:17 26 4
gpt4 key购买 nike

我正在努力处理这个双工 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>

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

<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 请求未经客户端身份验证方案‘协商’的授权。从服务器收到的身份验证 header 是‘NTLM’。”2. 在IIS6 上测试,调用永远不会到达服务器。我的预感是客户端端口未打开。

请帮助..提前致谢

*顺便说一句,我使用的是 Windows XP SP3、Framework 3.5 SP1、VS2008

最佳答案

我可以看到一个问题:

您不能在双工 http 绑定(bind)上使用传输级安全性,即使是自定义双工 http 绑定(bind)也是如此。

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

关于c# - WCF CustomBinding Duplex 无法打开客户端端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3367197/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com