473,805 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Threading Exception - Please Help

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

at System.Threadin g.WaitHandle.Wa itOneNative(Int Ptr waitHandle, UInt32
millisecondsTim eout, Boolean exitContext)
at System.Threadin g.WaitHandle.Wa itOne(Int32 millisecondsTim eout, Boolean
exitContext)
at System.Net.Http WebRequest.GetR equestStream()
when I use the System.Net.Http WebRequest.GetR equestStream() or the
System.Net.Http WebRequest.GetR esponseStream() 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,

objHttpWebReque st = (HttpWebRequest ) WebRequest.Crea te(
sURL );

objHttpWebReque st.ContentType = "text/xml";

bytBuffer = Encoding.ASCII. GetBytes( sData );

objHttpWebReque st.Method = "POST";
objHttpWebReque st.ContentLengt h = bytBuffer.Lengt h;

objWriteStream = objHttpWebReque st.GetRequestSt ream( );
objWriteStream. Write( bytBuffer, 0, bytBuffer.Lengt h );
objWriteStream. Close( );

// receive response
objHttpWebRespo nse = (HttpWebRespons e)
objHttpWebReque st.GetResponse( );
objResponseStre am = objHttpWebRespo nse.GetResponse Stream( );
bytBuffer = new byte[BUFFER_SIZE];
strOutput = new StringBuilder( );

iReadCount = objResponseStre am.Read( bytBuffer, 0,
BUFFER_SIZE );
while( iReadCount > 0 )
{
chrBuffer = Encoding.ASCII. GetChars( bytBuffer, 0,
iReadCount );
strOutput.Appen d( chrBuffer );
iReadCount = objResponseStre am.Read( bytBuffer, 0,
BUFFER_SIZE );
}
objResponseStre am.Close( );
objHttpWebRespo nse.Close( );

Thank you for your help this.

Chakra
Nov 17 '05 #1
1 1597
I forgot to mention that once this happens, the IIS server needs to be reset
before the application would start doing web posts again.
"Chakra Venkatesan" <ch******@hotma il.com> wrote in message
news:ek******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
I am getting an exception in my ASP.NET application as shown below,

at System.Threadin g.WaitHandle.Wa itOneNative(Int Ptr waitHandle, UInt32
millisecondsTim eout, Boolean exitContext)
at System.Threadin g.WaitHandle.Wa itOne(Int32 millisecondsTim eout, Boolean exitContext)
at System.Net.Http WebRequest.GetR equestStream()
when I use the System.Net.Http WebRequest.GetR equestStream() or the
System.Net.Http WebRequest.GetR esponseStream() 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,

objHttpWebReque st = (HttpWebRequest ) WebRequest.Crea te(
sURL );

objHttpWebReque st.ContentType = "text/xml";

bytBuffer = Encoding.ASCII. GetBytes( sData );

objHttpWebReque st.Method = "POST";
objHttpWebReque st.ContentLengt h = bytBuffer.Lengt h;

objWriteStream = objHttpWebReque st.GetRequestSt ream( );
objWriteStream. Write( bytBuffer, 0, bytBuffer.Lengt h );
objWriteStream. Close( );

// receive response
objHttpWebRespo nse = (HttpWebRespons e)
objHttpWebReque st.GetResponse( );
objResponseStre am = objHttpWebRespo nse.GetResponse Stream( );
bytBuffer = new byte[BUFFER_SIZE];
strOutput = new StringBuilder( );

iReadCount = objResponseStre am.Read( bytBuffer, 0,
BUFFER_SIZE );
while( iReadCount > 0 )
{
chrBuffer = Encoding.ASCII. GetChars( bytBuffer, 0,
iReadCount );
strOutput.Appen d( chrBuffer );
iReadCount = objResponseStre am.Read( bytBuffer, 0,
BUFFER_SIZE );
}
objResponseStre am.Close( );
objHttpWebRespo nse.Close( );

Thank you for your help this.

Chakra

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2994
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def get_all_files(path): """return all files of folder path, scan with subfolders
0
1329
by: Mark English | last post by:
Every once in a while since I moved to Python 2.4 I've been seeing the following exception in threading.py Condition: File "mctest3.py", line 1598, in WaitForMessages self.condResponses.wait(1.0) File "C:\Program Files\Python24\lib\threading.py", line 221, in wait delay = min(delay * 2, remaining, .05) OverflowError: long int too large to convert to int Is there something I'm doing wrong here ? I've looked at my code, and
1
2293
by: Tom | last post by:
I've googled, and read, and stripped out code, and rewritten code, and still can't get a System.Threading.Timer to work. (I hereby publicly admit that I'm a failure here...) Could someone please take a quick look at this and tell me where I'm going wrong? My actual use is more complex, but when I couldn't get that to work I created a new service project and figured to get a simple threading timer going first then I'd revamp my actual code...
0
1015
by: Stu | last post by:
Hi, i have some vb dot net code which needs to be a com+ component ie STA threaded so variables etc are protected. So ive built the component and set it up with component services But when i instaniate the component it keeps telling me its no STA apartment See following code :- Any ideas please this is very urgent
0
1993
by: Colmeister | last post by:
I recently read Jason Clark's excellent article on Unhandled Exceptions (http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx) and have attempted to incorporate the features he talks about in a new application I'm writing. However, when I try to use ThreadStart to do some work in a separate thread from my GUI, the methods Jason described don't seem to catch the exception. Take the following source code: Public Class...
17
6440
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. Note, the Windows task manager shows 2 CPUs on the Performance tab with hyper-threading is turned on. Both Python 2.3.5 and 2.4.3 (downloaded from python.org) have this problem. The operating system is MS Windows XP Professional.
7
2379
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has finished. I am trying to follow this example : http://www.codeproject.com/cs/miscctrl/progressdialog.asp But although the messages still get moved, the progress window never does anything. Here is my code in full, if anybody who knows...
0
3512
by: R K | last post by:
I am delevoping a Scheduler module whose functionality is to load the Scheduled Item Details every day (For this I have created a System.Threading.TimerCallBack with Timespan 1 day) in a stack. Once the stack is loaded I look for the qualified items every one minute (I create an another TimerCallBack thread). This Scheuler module needs to be started when the UI interface gets loaded. The issue lies in starting the shceduler since the...
0
1227
by: Edwin.Madari | last post by:
1. check out the Caveats for thread module: http://docs.python.org/lib/module-thread.html Threads interact strangely with interrupts: the KeyboardInterrupt exceptionwill be received by an arbitrary thread. (When the signal module is available, interrupts always go to the main thread.) i.e., all threads (including main) to catch interrupt exceptions, and propagate that information to other threads. 2. since there is no way to interrupt...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3839
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.