无法从客户端访问WCF双工 [英] Can not access WCF duplex from client
问题描述
我很困,没有任何想法,为什么我无法连接到WCF !!!
I'm STUCK and have no IDEA why I can't connect to my WCF!!!
详细信息:
我有一个双工WCF,它可以成功运行并在我的本地窗口中工作.我将其托管在服务器(IIS-server 2008 R2-STANDARD)中,并尝试进行连接,但是出现错误似乎是一个安全问题,我可以从Web浏览器访问它并获取所有xml....
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");
//我也尝试添加以下内容,但无效
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:
例外:
打开操作未在指定的超时时间内完成 00:00:59.0849477.分配给该操作的时间可能是 超时的一部分.
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.
我必须提到,我在同一IIS(非双工)中托管了另一个WCF,并且具有相同的用户(服务器用户名),并且运行良好. (我对两者都使用了相同的应用程序轮询,我还尝试创建新的应用程序池.
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.
如果我从要运行该应用程序的计算机上通过Web浏览器中的链接"http://xx.xx.xx.xx/_Bridge/_BridgeWcfService.svc",则得到了xml ...
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 :(?
这里是App.config:
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>
推荐答案
这听起来像是防火墙问题-涉及防火墙时,wsDualHttpBinding容易崩溃,因为它试图打开从服务器到服务器的连接.客户.我建议您使用NetTcpBinding进行双工通信.
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.
我在此处
这篇关于无法从客户端访问WCF双工的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!