我们在域内运行双通道服务。我们在端口 20120 上有一个 TCP 绑定,在端口 20121 上有一个 HTTP 绑定。
在 DMZ (web) 中,我们要访问这个 WCF 服务。防火墙似乎是从 web 到服务打开的。使用 telnet,我可以访问这两个端口,还可以从 Web 浏览器浏览 WSDL。现在,当我尝试从 Web 应用程序连接到服务时(它使用 TcpBinding,如果不重新部署新的二进制文件,我无法轻易将其更改为 HttpBinding,这是一个痛苦的过程),我得到一个异常。
System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9680000'.
System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.ServiceModel.Channels.ServiceChannelProxy.ExecuteMessage(Object target, IMethodCallMessage methodCall)
System.ServiceModel.Channels.ServiceChannelProxy.InvokeChannel(IMethodCallMessage methodCall)
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout)
System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout) ...
我们的测试环境都是内网,所以没有DMZ。那里一切正常。
服务本身作为域用户运行,并且客户端服务行为已配置其 userPrincipal(如 username@domain.ext)。这需要访问 domain.exe 的域控制器吗?
我还在服务端启用了 WCF 日志记录,但那里没有任何反应。一切都很平静,就像那里什么都没发生一样。是否还有其他地方我错过了检查连接断开的原因。
EDIT1:我写了一个小测试程序,建立 wcf 连接并调用 2 个方法。这在与服务相同的机器上以及从 dmz 网络上也可以正常工作。绑定设置相同。(确认)。我从 dmz 网络机器上的普通控制台以本地用户身份运行测试。任何提示?