Can not access WCF duplex from client

Deadly 提交于 2020-01-05 04:02:32

问题


I'm STUCK and have no IDEA why I can't connect to my WCF!!!

Details:

I have a duplex WCF, it successfully run and work in my local window. I host it in server (IIS - server 2008 R2-STANDARD), and trying to connect, but get an error seems like a security issue, I can access it from the web browser and get all the xml....

In my client I'm trying to access it as following:

this.myCallbackProxy = new MyCallbackProxy();
  InstanceContext cntx = new InstanceContext(myCallbackProxy);
  this.Proxy = new MyServiceClientProxy(cntx, "WSDualHttpBinding_I_BridgeWCFService");

//I try also to add the following, not works

this.Proxy.ClientCredentials.Windows.ClientCredential.UserName = "YY";
  this.Proxy.ClientCredentials.Windows.ClientCredential.Password = "PP";

The above passed with no errors or Exceptions. then:

try
{
this.Proxy.Open();
}
catch { -> here I get an exception:

Exception:

The open operation did not complete within the allotted timeout of 00:00:59.0849477. The time allotted to this operation may have been a portion of a longer timeout.

I must mention that I have another WCF hosted in same IIS (not duplex), with same user (server user name), and it works perfect. (I'm using same application poll for both, I also tried to create new application pool.

If I past the link "http://xx.xx.xx.xx/_Bridge/_BridgeWcfService.svc" in the web browser from the machine I want to run the application, I get the xml... as expected.

Both service and client have security = "none"

Any Idea why I can't connect :(?

Here the App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
  <wsDualHttpBinding>
    <binding name="WSDualHttpBinding_I_BridgeWCFService" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
      maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483646"
        maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"/>
      <security mode="None"/>
    </binding>
  </wsDualHttpBinding>
</bindings>
<client>
  <endpoint address="http://xx.xx.xx.xx/_Bridge/_BridgeWcfService.svc" 
            binding="wsDualHttpBinding" 
            bindingConfiguration="WSDualHttpBinding_I_BridgeWCFService" 
            contract="_BridgeWcfServiceReference.I_BridgeWCFService" 
            name="WSDualHttpBinding_I_BridgeWCFService">
    <identity>
      <dns value="localhost"/>
    </identity>
  </endpoint>
</client>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>
</configuration>

回答1:


This sounds like a firewall issue - wsDualHttpBinding is prone to blowing up as soon as a firewall is involved as it tries to open a connection from the server back to the client. I'd advise using NetTcpBinding for your duplex communication.

I blogged about this here



来源:https://stackoverflow.com/questions/8929552/can-not-access-wcf-duplex-from-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!