Threading Exception - Please Help

  • Thread starter Chakra Venkatesan
  • Start date
C

Chakra Venkatesan

Hi,
I am getting an exception in my ASP.NET application as shown below,

at System.Threading.WaitHandle.WaitOneNative(IntPtr waitHandle, UInt32
millisecondsTimeout, Boolean exitContext)
at System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean
exitContext)
at System.Net.HttpWebRequest.GetRequestStream()


when I use the System.Net.HttpWebRequest.GetRequestStream() or the
System.Net.HttpWebRequest.GetResponseStream() methods. This doesn't
happen always but happens after the application is in use for sometime.
There is no definite pattern. I am not able to reproduce this during
load testing.

What is this exception and why is it happenning? I am calling another web
application and do a POST using the HttpWebRequest.

Here is a snippet of my code,

objHttpWebRequest = (HttpWebRequest) WebRequest.Create(
sURL );

objHttpWebRequest.ContentType = "text/xml";

bytBuffer = Encoding.ASCII.GetBytes( sData );

objHttpWebRequest.Method = "POST";
objHttpWebRequest.ContentLength = bytBuffer.Length;

objWriteStream = objHttpWebRequest.GetRequestStream( );
objWriteStream.Write( bytBuffer, 0, bytBuffer.Length );
objWriteStream.Close( );

// receive response
objHttpWebResponse = (HttpWebResponse)
objHttpWebRequest.GetResponse( );
objResponseStream = objHttpWebResponse.GetResponseStream( );
bytBuffer = new byte[BUFFER_SIZE];
strOutput = new StringBuilder( );

iReadCount = objResponseStream.Read( bytBuffer, 0,
BUFFER_SIZE );
while( iReadCount > 0 )
{
chrBuffer = Encoding.ASCII.GetChars( bytBuffer, 0,
iReadCount );
strOutput.Append( chrBuffer );
iReadCount = objResponseStream.Read( bytBuffer, 0,
BUFFER_SIZE );
}
objResponseStream.Close( );
objHttpWebResponse.Close( );

Thank you for your help this.

Chakra
 
C

Chakra Venkatesan

I forgot to mention that once this happens, the IIS server needs to be reset
before the application would start doing web posts again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top