开发者

wsDualHttpBinding not working outside network with WPF Client

开发者 https://www.devze.com 2023-02-11 05:25 出处:网络
I was trying to implement a DuplexCommunication between WPF and WCF, the communication is working good when test internally, with in the network, when we tried to access this outside network after pub

I was trying to implement a DuplexCommunication between WPF and WCF, the communication is working good when test internally, with in the network, when we tried to access this outside network after publishing it outside, we are able to access the service thru web browser, but the WPF client is giving error, when we try to open the connection. below are the configuration on both Server and Client side. Server:

  <wsDualHttpBinding>
    <binding closeTimeout="00:01:00"
                   openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                   bypassProxyOnLocal="false" transactionFlow="false" hostNameC开发者_StackOverflowomparisonMode="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>

Client:

<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>

I have tried giving 'baseAddresses' and 'identity' with dns value on server side, also tried giving clientBaseAddress on client side, but still it wont work outside the network.

always getting timeout error when trying to open the duplex connection from WPF application: Error: "The open operation did not complete within the allotted timeout of 00:00:09.4911018. The time allotted to this operation may have been a portion of a longer timeout."

I think there is something wrong on the config part, but not sure what it is, any help on this much appreciated .

Thanks.


WsDualHttpBinding is not suitable for crossing firewalls - it requires the server open a connection to the client, by default on random address on port 80. The port used can be configured by the clientBaseAddress on the binding but still requires the fire wall to allow inbound connections which, you would hope, the network admins would prevent. If you want to do duplex work in WCF then you should use NetTcpBinding which uses a single outbound connection and the callbacks are performed over this connection

I blogged about this here


Is port 80 open on the client to accept incoming connections, and properly port forwarded through any NAT routers? Dual HTTP Bindings require the server to be able to open a second HTTP connection to the client, and on the Internet (off the LAN) that almost always fails due to firewalls and home routers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号