Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
1.75/5 (4 votes)
See more:
In my ASP.Net web application, one of the function is calling the WCF service that has been developed by .Net framework 3.0 using VS2005.It works fine on production and user can make request 8 times(calls) between client and service after that the web application got hanged and generated the following error message. But it works fine on development even more than 8 requests.
I given the proxy time out 20 min in the client side proxy setting.

Error message:
System.Threading.ThreadAbortException: Thread was being aborted.     
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.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)  
   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.Connection.PollAndRead(HttpWebRequest request, Boolean userRetrievedStream)
     at System.Net.ConnectStream.PollAndRead(Boolean userRetrievedStream)
     at System.Net.HttpWebRequest.EndWriteHeaders(Boolean async)   
  at System.Net.HttpWebRequest.WriteHeadersCallback(WebExceptionStatus errorStatus, ConnectStream stream, Boolean async) 
    at System.Net.ConnectStream.WriteHeaders(Boolean async)   
  at System.Net.HttpWebRequest.EndSubmitRequest()   
  at System.Net.HttpWebRequest.CheckDeferredCallDone(ConnectStream stream) 
    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.Channels.ClientReliableChannelBinder`1.RequestClientReliableChannelBinder`1.OnRequest(TRequestChannel channel, Message message, TimeSpan timeout, MaskingMode maskingMode)  
   at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout, MaskingMode maskingMode)    
 at System.ServiceModel.Channels.ClientReliableChannelBinder`1.Request(Message message, TimeSpan timeout) 
 
    at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)   
  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 MyWebApp.MYWCFService.IServiceInterface.SelectSerialNumber(SerialNumberAssignmentRequest request) 
    at MyWebApp.MYWCFService.ServiceInterfaceClient.SelectSerialNumber (SerialNumberAssignmentRequest request) 
    at MyWebApp._Default.PopulateSerialNumberDetails(SerialNumberAssignmentRequest request)


Could you please help me to figure out why it causing this error?
Posted
Updated 16-Apr-11 2:27am
v2
Comments
Sergey Alexandrovich Kryukov 16-Apr-11 14:40pm    
Hardly, because you're not showing any code.
--SA

1 solution

Make sure that you are disposing your client connections, preferably using "using" statements. Default, the total number of concurrent connections is 10 with WCF. This is close to your 8 client connections.
 
Share this answer
 
Comments
ragupathi.p 19-Apr-11 5:46am    
Thanks for your reply.
As your suggestion, I found one function has not closed the proxy connection properly and then I closed whereever it's required.

Now it comes upto 10 request and application got hanged and it generated the same error.

Do you have any idea why it causing the same error even closed the proxy connection?
Patrick Kalkman 19-Apr-11 10:24am    
What you could do is increase the total number of concurrent calls and/or sessions (to 20) and check if you can make 20 requests. If this is the case you are still not releasing the connections. Make sure that you use the dispose pattern on the connections.

Look at http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicethrottlingbehavior.maxconcurrentcalls.aspx for information on how to increase the number of calls and sessions

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900