Wednesday, December 05, 2007 5:58 PM
I have an xml webservice calling another xml web service and occasionally i get the following error - any ideas why?Does this happen when the request is made or when reading the response? Also how i can prevent it from happening? Thanks
System.IO.IOException: Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. ---> System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall
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)
--- End of inner exception stack trace ---
at System.Net.ConnectStream.Read(Byte buffer, Int32 offset, Int32 size)
at System.IO.StreamReader.ReadBuffer(Char userBuffer, Int32 userOffset, Int32 desiredChars, Boolean readToUserBuffer)
at System.IO.StreamReader.Read(Char buffer, Int32 index, Int32 count)
at System.Xml.XmlTextReaderImpl.InitTextReaderInput(String baseUriStr, TextReader input)
at System.Xml.XmlTextReaderImpl..ctor(String url, TextReader input, XmlNameTable nt)
at System.Xml.XmlTextReader..ctor(TextReader input)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetReaderForMessage(SoapClientMessage message, Int32 bufferSize)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object parameters)
Friday, December 07, 2007 1:17 AMModerator
It might be that the call to your second webservice is timing out or before it finishes reading your parent webservice is timing out.
Try increasing the timeout for the call to the second webservice and also make sure your parent webservice has higher timeout than the call to second web service.
Friday, December 07, 2007 1:52 AMModerator
Just for information: This is a repro that would simulate a simillar scenario and causes simillar exception trace.
worker.DoWork +=new DoWorkEventHandler(StartListening);
worker.RunWorkerAsync();//Connect to the service TcpClient client = new TcpClient("localhost", 8989);
client.ReceiveTimeout = 200;// This thread will try to close the client connection, before the ReadByte completes. new Thread(new ParameterizedThreadStart(CloseClientConnection)).Start(client);
}static void StartListening(object sender, DoWorkEventArgs e)
Friday, August 27, 2010 8:54 PM
I know I should open my own topic, but I don't see the point in that, because everything to explain is here, and the code is similiar, the idea is the same.
My app also raises that exception when the thread is reading the bytes and I press CAncel button, which will abort the thread. Sometimes it raises the exception, but sometimes doesn't.
The code is similar to the above one. There's a method to download using a different thread and there's a cancel button which will abort the download, that is, abort the thread.
He said about increase the timeout, but it does not work. I don't have one webservice calling another, I have only one.
So, what do to?
Get a life. Go party!
Sunday, August 29, 2010 2:19 AMModerator
Start a new thread.
This one is from three years ago and there was no real answer so how do you know yours is the same?
WCF is Web Services. They are not two separate things.
Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
Use File->New Project to create Web Service Projects