0

我正在用这个在黑暗中拍摄,但我一直遇到一个问题,我希望有人可能以前遇到过......我的客户端进行了服务器调用,它几乎只是从 Sql 服务器中获取数据DB 并将其返回给我的客户端,但有时客户端从未收到来自服务器的响应。我输入了一堆登录信息并执行了服务器端代码的最后一行,但客户端仍然没有收到响应,结果卡在“正在处理”...我添加了一个 WCF 跟踪并使用服务对其进行监视跟踪查看器。

WCF 活动跟踪

我在包含以下文本的活动日志中看到异常:

    <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>

我想没有人以前见过这样的东西,并且可以给我一些关于如何修复它的建议?任何信息将不胜感激。

谢谢!

4

1 回答 1

3

一个CommunicationException诸如“套接字连接已中止。这可能是……”之类的错误消息只是一般故障情况,是实际错误的副作用。

要找出实际错误是什么,请使用 WCF 跟踪输出。选择标记为的项目Exceptions并查看这些项目的详细信息窗格。其中之一很可能会为您提供有关错误的更明确的信息——这实际上可能是您迄今为止提供的任何内容。

在客户端和服务器上建立跟踪,当您在跟踪窗口中看到异常时,将其突出显示以在右侧窗格中显示更多详细信息。

于 2013-06-11T22:02:33.273 回答