【发布时间】:2012-01-19 16:24:02
【问题描述】:
我很困惑,不知道为什么我无法连接到我的 WCF !!!
详情:
我有一个双工 WCF,它在我的本地窗口中成功运行和工作。我将它托管在服务器(IIS - 服务器 2008 R2-STANDARD)中,并尝试连接,但出现错误似乎是一个安全问题,我可以从 Web 浏览器访问它并获取所有 xml....
在我的客户端中,我尝试按以下方式访问它:
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";
以上通过,没有错误或异常。 那么:
try
{
this.Proxy.Open();
}
catch { -> here I get an exception:
例外:
打开操作未在分配的超时时间内完成 00:00:59.0849477。分配给此操作的时间可能是 较长超时的一部分。
我必须提到,我在同一个 IIS(非双工)中托管了另一个 WCF,具有相同的用户(服务器用户名),它运行良好。 (我对两者都使用相同的应用程序轮询,我也尝试创建新的应用程序池。
如果我从我想要运行应用程序的机器上通过 Web 浏览器中的链接“http://xx.xx.xx.xx/_Bridge/_BridgeWcfService.svc”,我会按预期获得 xml... .
服务和客户端都有 security = "none"
知道为什么我无法连接:(?
这里是 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>
【问题讨论】:
-
您的服务代理上还有哪些其他操作?你可以调用那些而不是 Open() 吗?
-
不!!!,如果我在这里删除打开,任何操作都会抛出同样的异常:“打开操作没有在分配的超时时间 00:00:59.9939996 内完成。分配给这个操作的时间可能是较长超时的一部分。”