2

I have a WCF service run on Windows Server 2008 RC2 IIS 7 with no firewall. When I trying to call it with netTcpBinding binding, I get this exception:

System.TimeoutException: The open operation did not complete within the allotted timeout of 00:00:30. The time allotted to this operation may have been a portion of a longer timeout. ---> System.TimeoutException: The socket transfer timed out after 00:00:30. You have exceeded the timeout set on your binding. The time allotted to this operation may have been a portion of a longer timeout. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)...

The method I call just returns a numeric value, nothing else, so the problem not in timeout. If I use wsHttpBinding - it works without problems. Also I added logging to method I call, so I know that it even not executed.

I made all steps to configure IIS from here. The questions are:

  1. Anybody know what the problem may be?
  2. How can I troubleshoot/debug this problem?
4

1 回答 1

1

我和你一样对这个误导性的故障信息感到沮丧。如果我没记错的话,你会在第一秒内得到这个 TimeoutException。我可以向您保证您的问题与安全或序列化问题有关。我将此问题提交给 Microsoft 的 WCF 产品组,他们似乎很惊讶,但没有收到任何回复。

第一个建议是查看 NetTcpBinding 安全设置。确保客户端和服务具有相同的基本安全设置开始(例如不是消息加密或传输层安全)。如果您可以使其在没有安全性的情况下工作,请逐步增加安全性设置。

第二个建议是一些序列化问题可能导致服务崩溃:一个空的可空字段、与操作混合的重载方法、模糊的合同名称、无效的强制转换。要调试,在服务的配置设置中设置跟踪。您可以通过 WCF 服务配置实用程序 (SvcConfigEditor.exe) 轻松完成此操作。运行您的服务获取异常,停止它并使用 WCF 服务跟踪查看器工具打开生成的跟踪日志。这两个工具都带有 .NET(不是 Visual Studio),可以在 Program Files/Windows SDKs 文件夹中找到。

于 2011-02-02T08:40:43.173 回答