0

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

WCF Activity Trace

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!

Franco Trombetta
  • 207
  • 1
  • 5
  • 14
  • does the assembly containing the service contract have a strong name? (in other words ... is it signed?) – DarkSquirrel42 Jun 11 '13 at 21:41
  • It seems your connection is timing out. Maybe your problem is similar to this http://stackoverflow.com/questions/11946117/wcf-inactivity-timeout – dsfgsho Jun 11 '13 at 22:03

1 Answers1

3

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.

To find out what the actual error is, use your WCF trace output. Select the items marked as Exceptions and look at the details pane for those. 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.

RJ Lohan
  • 6,497
  • 3
  • 34
  • 54
  • I second this approach, i had lots of issues like that when using EF to hydrate pocos. Sometimes it was a circular reference, sometimes it was a value that it couldn't serialize. using the Wcf tracer lets you dig into the guts to see what caused it. – Slicksim Jun 12 '13 at 08:22
  • Thanks for taking out the time to respond to my question. I'm sorry, I'm new to this process. I have my trace file, and I'm using the Service Trace Viewer to analyze its contents. I see the exceptions in the trace but there seem to be 2 exceptions both with that generic message. How can I get a more specific error? Do I have to change my trace settings? – Franco Trombetta Jun 12 '13 at 14:46
  • 1
    That is what I used to configure my trace but the 2 exceptions I see (Which I posted above) only give me that one 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'."... Was there anything else I could do to get more information ? All my server side code executes successfully, my timeouts are all appropriately set... not sure what else can be causing this. – Franco Trombetta Jun 13 '13 at 12:27
  • Set up tracing on server & client, and view the details of the exception by highlighting that row and viewing more info on the RHS. – RJ Lohan Jun 13 '13 at 21:07
  • Yeah. Again, I did that. I posted the exceptions above. There don't seem to be any more details for the exceptions other than what i posted. I guess I'll set up a client side trace and see if that gives me anything different. Thanks for attempting to help. – Franco Trombetta Jun 14 '13 at 12:45