简体   繁体   English

服务器调用期间WCF通信异常

[英]WCF Communication Exception During Server Call

I'm taking a shot in the dark with this one but I've been experiencing an issue that I'm hoping someone might have come across before...My client makes a server call which pretty much just grabs data from a Sql server DB and returns it to my client however sometimes the client never receives a response from the Server. 我在黑暗中对此进行了拍摄,但遇到了一个问题,我希望有人之前可能遇到过...我的客户端进行服务器调用,而该调用几乎只是从Sql服务器中获取数据DB并将其返回给我的客户端,但是有时客户端永远不会收到服务器的响应。 I put a bunch of logging in and the very last line of server side code is executed but still, the client never receives the response and as a result gets stuck "PROCESSING"... I added a WCF trace and monitored it using the Service Trace Viewer. 我进行了大量登录,并执行了服务器端代码的最后一行,但是仍然,客户端从未收到响应,结果卡在了“ PROCESSING”中……我添加了WCF跟踪并使用Service对其进行了监视跟踪查看器。

WCF活动跟踪

And I'm seeing exceptions in the Activity logs that contain the following text: 而且我在“活动”日志中看到了包含以下文本的异常:

    <E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
    <EventID>131075</EventID>
    <Type>3</Type>
    <SubType Name="Error">0</SubType>
    <Level>2</Level>
    <TimeCreated SystemTime="2013-06-11T19:38:52.8094768Z" />
    <Source Name="System.ServiceModel" />
    <Correlation ActivityID="{a3b3598e-8ce1-4afc-8cf2-89c6fa505061}" />
    <Execution ProcessName="TwoFour.WCF.App" ProcessID="5056" ThreadID="111" />
    <Channel />
    <Computer>VA3WEB-REMEDY01</Computer>
    </System>
    <ApplicationData>
    <TraceData>
    <DataItem>
    <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
    <TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
    <Description>Throwing an exception.</Description>
    <AppDomain>TwoFour.WCF.App.exe</AppDomain>
    <Exception>
    <ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
    <Message>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 '10675199.02:48:05.4775807'.</Message>
    <StackTrace>
    at System.ServiceModel.Channels.SocketConnection.EndRead()
    at System.ServiceModel.Channels.TracingConnection.EndRead()
    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()
    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)
    at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
    </StackTrace>
    <ExceptionString>System.ServiceModel.CommunicationException: 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 '10675199.02:48:05.4775807'. ---&gt; System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
       --- End of inner exception stack trace ---</ExceptionString>
    <InnerException>
    <ExceptionType>System.Net.Sockets.SocketException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
    <Message>An existing connection was forcibly closed by the remote host</Message>
    <StackTrace>
    at System.ServiceModel.Channels.SocketConnection.EndRead()
    at System.ServiceModel.Channels.TracingConnection.EndRead()
    at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
    at System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()
    at System.ServiceModel.Channels.SocketConnection.AsyncReadCallback(Boolean haveResult, Int32 error, Int32 bytesRead)
    at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
    </StackTrace>
    <ExceptionString>System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host</ExceptionString>
    <NativeErrorCode>2746</NativeErrorCode>
    </InnerException>
    </Exception>
    </TraceRecord>
    </DataItem>
    </TraceData>    
</ApplicationData>

I don't suppose anyone has seen something like this before and can give me some recommendations as to how I can go about fixing it? 我认为以前没有人见过这样的东西,并且可以就如何解决该问题提供一些建议吗? Any information would be greatly appreciated. 任何信息将不胜感激。

Thanks! 谢谢!

A CommunicationException with an error message like "The socket connection was aborted. This could be..." is just a general failure condition and is the side-effect of the actual error. 带有错误消息(例如“套接字连接已中止。这可能是...”)的CommunicationException只是一般的失败情况,是实际错误的副作用。

To find out what the actual error is, use your WCF trace output. 要找出实际的错误是什么,请使用WCF跟踪输出。 Select the items marked as Exceptions and look at the details pane for those. 选择标记为“ Exceptions的项目,然后在详细信息窗格中查看这些项目。 One of them will most likely give you more explicit information as to the error - which really could be anything from what you've provided so far. 其中之一很可能会为您提供有关错误的更明确的信息-到目前为止,您提供的信息实际上可能是任何东西。

Establish tracing on both the client and server, and when you see an exception in the trace window, highlight it to show more details in the right-hand-side panes. 在客户端和服务器上都建立跟踪,当您在跟踪窗口中看到异常时,将其突出显示以在右侧窗格中显示更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM