当客户端甚至无法连接到WCF服务器时,为什么会出现"服务器堆栈跟踪"的异常?

sha*_*oth 5 .net c# wcf

在我的代码中,我向https://端点发出WCF请求.有时WCF服务器无论出于何种原因都无法访问,然后我的代码将产生和异常:

System.TimeoutException
The request channel timed out while waiting for a reply after 00:01:00.
Increase the timeout value passed to the call to Request or increase
the SendTimeout value on the Binding. The time allotted to this operation
may have been a portion of a longer timeout.
Run Code Online (Sandbox Code Playgroud)

.StackTrace异常包含以下文本:

Server stack trace: <<<< THE QUESTION IS ABOUT THIS VERY LINE
   at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at [my code here invoking an OperatiionContract-attributed method
Run Code Online (Sandbox Code Playgroud)

.InnerException另一个TimeoutException是以下消息:

The HTTP request to 'https://management.core.windows.net/subscription-id-here/
   services/hostedservices/service-name-here/deployments/deployment-id-here'
has exceeded the allotted timeout of 00:01:00. The time allotted to this
operation may have been a portion of a longer timeout.
Run Code Online (Sandbox Code Playgroud)

我没有得到的是Server stack trace措辞.

如果我的请求甚至没有被服务器响应,为什么它是"服务器"?

Mat*_*ter 0

连接两端都可能发生超时;客户端或服务器。因此,根据您的异常,我会说客户端已连接到服务器,但由于未及时生成响应(基于服务器的绑定sendTimeout),WCF 的响应如您所见。

有关超时设置的更多信息,请参阅http://msdn.microsoft.com/en-us/library/hh924831(v=vs.110).aspx 。