简体   繁体   中英

“Thread was being aborted” in WCF Service Call

In my program there is a aspx page that contains wcf client, that so on calls wcf service located on same server.

I`v get this exception when my wcf client calls wcf service hosted in IIS on production server.

Ex. msg: Thread was being aborted.

Ex stack:

at System.Net.UnsafeNclNativeMethods.OSSOCK.recv(IntPtr socketHandle, Byte* pinnedBuffer, Int32 len, SocketFlags socketFlags) at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) at System.Net.ConnectStream.ProcessWriteCallDone(ConnectionReturnResult returnResult) at System.Net.ConnectStream.CallDone(ConnectionReturnResult returnResult) at System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream, Boolean suppressWrite) at System.Net.HttpWebRequest.EndWriteHeaders_Part2() at System.Net.HttpWebRequest.EndWriteHeaders(Boolean async) at System.Net.HttpWebRequest.WriteHeadersCallback(WebExceptionStatus errorStatus, ConnectStream stream, Boolean async) at S ystem.Net.ConnectStream.WriteHeaders(Boolean async) at System.Net.HttpWebRequest.EndSubmitRequest() at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.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) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at StationService.IStationService.GetCurrentStationTrack(String stationId) at StationS ervice.StationServiceClient.GetCurrentStationTrack(String stationId) at GetSongJS.getMarq(String radioIdentifier)

I using PRTG Ipmonitor and it give me too many requests on "Requests Current" sensor. My site becomes anavailable in browser. If a delete this page that calls service all is going to be OK.

It sounds like you are not closing the WCF client.

What I think is happening is:

  • User calls the aspx page
  • aspx page calls the service
  • aspx page returns to the user
  • the service client is not closed, therefore request is open and number of current requests is high
  • eventually you have the max number of requests open
  • the page waits for a free connection, when it does not get one the aspx page timesout
  • you then get a thread abort exception from the timeout

Is there a Response.Redirect(url) call after the client proxy makes its call? The single argument overload will terminate the current thread which leads to many of these types of errors showing up in logs. Sometimes the page has finished working and it doesn't happen, but switching to another busier environment is often a trigger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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