我试图在 WPF 和 WCF 之间实现 DuplexCommunication,在内部测试时通信运行良好,在网络中,当我们在外部发布后尝试访问这个外部网络时,我们能够通过 Web 浏览器访问服务,但是当我们尝试打开连接时,WPF 客户端给出了错误。下面是服务器端和客户端的配置。服务器:
<wsDualHttpBinding>
<binding closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None" />
</binding>
</wsDualHttpBinding>
<service behaviorConfiguration="DuplexServices.DuplexServiceBehavior" name="DuplexServices.DuplexService">
<endpoint address="dual" binding="wsDualHttpBinding" contract="DuplexServices.IDuplexService" >
</endpoint>
</service>
客户:
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_DuplexService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" >
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="None">
</security>
</binding>
</wsDualHttpBinding>
<client>
<endpoint address="http://XXX.com/DuplexServices/DuplexService.svc/dual"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_DuplexService"
contract="DuplexServiceeReference.DuplexService" name="WSDualHttpBinding_DuplexService">
</endpoint>
</client>
我尝试在服务器端提供带有 dns 值的“baseAddresses”和“identity”,也尝试在客户端提供 clientBaseAddress,但它仍然无法在网络之外工作。
尝试从 WPF 应用程序打开双工连接时总是出现超时错误:错误:“打开操作未在分配的 00:00:09.4911018 超时内完成。分配给此操作的时间可能是较长超时的一部分。”
我认为配置部分有问题,但不确定是什么,对此非常感谢。
谢谢。