Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
wsDualHttpBinding在网络外与WPF客户端不工作_Wpf_Wcf_Pollingduplexhttpbinding_Wsdualhttpbinding_Duplex Channel - Fatal编程技术网

wsDualHttpBinding在网络外与WPF客户端不工作

wsDualHttpBinding在网络外与WPF客户端不工作,wpf,wcf,pollingduplexhttpbinding,wsdualhttpbinding,duplex-channel,Wpf,Wcf,Pollingduplexhttpbinding,Wsdualhttpbinding,Duplex Channel,我尝试在WPF和WCF之间实现双工通信,在内部测试时通信工作良好,在网络中,当我们在外部发布后尝试访问此外部网络时,我们可以通过web浏览器访问服务,但当我们尝试打开连接时,WPF客户端出现错误。下面是服务器端和客户端的配置。 服务器: 客户: <wsDualHttpBinding> <binding name="WSDualHttpBinding_DuplexService" closeTimeout="00:01:00"

我尝试在WPF和WCF之间实现双工通信,在内部测试时通信工作良好,在网络中,当我们在外部发布后尝试访问此外部网络时,我们可以通过web浏览器访问服务,但当我们尝试打开连接时,WPF客户端出现错误。下面是服务器端和客户端的配置。 服务器:


客户:

<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内完成。分配给此操作的时间可能是更长超时的一部分。”

我认为配置部分有问题,但不确定是什么问题,非常感谢您提供的任何帮助


谢谢。

客户端上的端口80是否打开以接受传入连接,并通过任何NAT路由器正确转发端口?双HTTP绑定要求服务器能够打开到客户端的第二个HTTP连接,并且在Internet上(离开LAN),由于防火墙和家庭路由器的原因,该连接几乎总是失败。

客户端上的端口80是否打开以接受传入连接,并通过任何NAT路由器正确转发端口?双HTTP绑定要求服务器能够打开到客户端的第二个HTTP连接,并且在Internet上(离开LAN),由于防火墙和家庭路由器,几乎总是会出现故障。

WsDualHttpBinding不适合跨越防火墙-它要求服务器打开到客户端的连接,默认情况下,端口80上的随机地址。使用的端口可以由绑定上的clientBaseAddress配置,但仍然需要防火墙来允许入站连接,您希望网络管理员能够阻止这种连接。如果您想在WCF中执行双工工作,那么应该使用NetTcpBinding,它使用单个出站连接,并且回调是通过该连接执行的


我在博客中提到了这一点

WsDualHttpBinding不适合跨越防火墙-它要求服务器打开到客户端的连接,默认情况下,在端口80的随机地址上。使用的端口可以由绑定上的clientBaseAddress配置,但仍然需要防火墙来允许入站连接,您希望网络管理员能够阻止这种连接。如果您想在WCF中执行双工工作,那么应该使用NetTcpBinding,它使用单个出站连接,并且回调是通过该连接执行的


我在博客上写了这个

,你收到了什么错误?你收到了什么错误?是的,但是你需要打开客户端和服务器上的端口,这是网络用户真正不喜欢的。如果我在互联网上有10000个客户端呢。这是对UPnP或端口转发的大量支持。是的,但是你需要同时打开客户端和服务器上的端口,这是网络用户真正不喜欢的。如果我在互联网上有10000个客户端呢。这是对UPnP或端口转发的大量支持。
<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>