我尝试使用 WSDualHttpBinding 实现 WCF 回调。该服务托管在 IIS 7 上。
当我在与主机相同的机器上为服务创建示例客户端时,它工作正常。但是当我从网络上的不同系统运行同一个客户端时,我得到了超时异常
服务器堆栈跟踪:在 System.ServiceModel.Channels.ReliableRequestor.ThrowTimeoutException() 在 System.ServiceModel.Channels.ReliableRequestor.Request(TimeSpan timeout) 在 System.ServiceModel.Channels.ClientReliableSession.Open(TimeSpan timeout) 在 System.ServiceModel.Channels .ClientReliableDuplexSessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)在 System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel 通道,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan 超时,CallOnceManager 级联)在系统.ServiceModel.Channels。System.ServiceModel.Channels.ServiceChannel.Call 中的 ServiceChannel.EnsureOpened(TimeSpan 超时)(字符串操作,布尔单向,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannel.Call (字符串操作,布尔单向,ProxyOperationRuntime 操作,Object[] 输入,Object[] 输出)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage 方法调用,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 的 ProxyOperationRuntime 操作,Object[] ins,Object[] outs)System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 的 ProxyOperationRuntime 操作,Object[] ins,Object[] outs)
CallbackContract 如下所示:
public interface IMyServiceCallBack
{
[OperationContract(IsOneWay = true)]
void Notify();
}
我也指定了
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession,ConcurrencyMode = ConcurrencyMode.Reentrant)]
Client上的app.config如下:
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_Callback" closeTimeout="00:01:00" clientBaseAddress="http://10.1.3.199:8002/myServiceHost/myService.svc/Endpoint"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="97108864" maxReceivedMessageSize="97108864"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="97108864" maxArrayLength="97108864"
maxBytesPerRead="97108864" maxNameTableCharCount="97108864" />
<security mode="None"/>
</binding>
</wsDualHttpBinding>
<client>
<endpoint address="http://10.1.3.199/myServiceHost/myService.svc/Endpoint"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_Callback"
contract="myService.ServiceContract" name="WSDualHttpBinding_Callback" />
</client>
我错过了什么!!!