473,796 Members | 2,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

async pages and redirect

I am having trouble doing a redirect in an async asp.net implemention.
Most of the time it works, but when it doesn't it just "hangs", the browser
never gets any return page. If I run it under the debugger, it works fine,
though every so often I get a HttpException.

System.Web.Http Exception was caught
ErrorCode=-2147024809
Message="An error occurred while communicating with the remote host. The
error code is 0x80070057."
Source="System. Web"
StackTrace:
at
System.Web.Host ing.ISAPIWorker RequestInProcFo rIIS6.FlushCore (Byte[] status,
Byte[] header, Int32 keepConnected, Int32 totalBodySize, Int32
numBodyFragment s, IntPtr[] bodyFragments, Int32[] bodyFragmentLen gths, Int32
doneWithSession , Int32 finalStatus, Boolean& async)
at System.Web.Host ing.ISAPIWorker Request.FlushCa chedResponse(Bo olean
isFinal)
at System.Web.Host ing.ISAPIWorker Request.FlushRe sponse(Boolean
finalFlush)
at System.Web.Http Response.Flush( Boolean finalFlush)
at System.Web.Http Response.Flush( )
at System.Web.Http Response.End()
at System.Web.Http Response.Redire ct(String url, Boolean endResponse)
at w2pagev.PageV.E ndPage(IAsyncRe sult ar) in
G:\inetpub\wwwr oot\w2pagev\pag e.aspx.vb:line 100

The exception is caught in the EndEventHandler .
I am using AddOnPreRenderC ompleteAsync to set this up.


Feb 22 '07
12 3473
On Feb 23, 10:48 am, "John Saunders" <john.saunder s at trizetto.com>
wrote:
"pb" <p...@newsgroup s.nospamwrote in message

news:3A******** *************** ***********@mic rosoft.com...


"Steven Cheng[MSFT]" wrote:
Thanks for your followup Pb,
After got the code snippet you provided, I notice that your
implementation
is quite different as I expect. Yes, you haven't simply used the existing
asynccomponent s (like delegate or WebRequest...) and manually create a
normal sub thread to do the work.
And in addition to the "IAsyncResu lt" implmentation class, another thing
you haven't provided is your thread proc function. You need to ensure
the
passed in callback should be invoked at the end of your thread proc
function(when the task has finished). Also, I think the occasional hang
problem does be possible related to the IAsyncResult implementation. You
can try using Delegate.BeginI nvoke approach to run the same stuff to see
whether it will lead to the same behvior.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
Steven-
a couple of things... i don't think i am having any more trouble with the
redirectnow that i've moved it (see previous code). i do, however,
experience "hangs" when running the new thread model under load (using
WCAT).
over the course of several hours, i will see ASP.NET restart several times
when it failed to respond to the IIS ping. i do not experience these hangs
when i switch to my old implementation (i have a simple switch that runs
it
asyncor not).

Make very certain that you have a try/catch block around all of your
threads. Otherwise, an unhandled exception will just quietly kill the
thread.

John- Hide quoted text -

- Show quoted text -
john,

that's an important point. if an exception aborts the thread before
it completes EndPage won't be called. what does ASP.NET do in that
case? does it just time out the initial thread that dispatched the
page (the CLR thread pool thread)? i imagine, even if it timed out
the dispatch thread that all the thread pool threads could be consumed
in this case and then ASP.NET would "hang"... and IIS would be forced
to restart it. i will make certain my thread always completes to the
caller regardless of what is does in between!

/phil

Feb 25 '07 #11
Thanks for your reply Pb,

I'll have a further check and test based on the code you provided. I'll
update you as soon as possible.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 28 '07 #12
Hi Pb,

Sorry for the dely update. After some further research, I still haven't
been able to address the root cause of the issue. The difficulty here is
that the behavior is quite hard to test in development, and the underlying
cause require some low level debugging. After discussing with some other
engineers, we suggest you consider contact CSS for further troubleshooting
on this issue:

http://msdn.microsoft.com/subscripti...t/default.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 7 '07 #13

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

Similar topics

7
2625
by: PaulThomas | last post by:
I am fighting with XP-Pro and VS.Net trying to allow some of the pages in my application to be accessable by 'all' I am using <authentication mode="Forms" /> and if I Login - everything works fine. My code comes from a walkthrough (I am learning) and I am currently using (User.Identity.IsAuthenticated) in the Login.aspx page to validate UserID against my database (I like it). What I need is a 'simple' method by which I can set some...
6
10459
by: Vanessa | last post by:
I have a question regarding async mode for calling Microsoft.XMLHTTP object. Microsoft.XMLHTTP hangs the IE once in a while suddenly, but it will work again after half an hour or so without doing anything. I have searched through the Internet and seems like the reason it hangs the browser it's because XMLHTTP limits you to two concurrent HTTP connections to each remote host; so if more than 2 concurrent connections strike the script...
4
3924
by: Bob Johnson | last post by:
Hello people. Short background -- I am constructing a web site that will have several display tabs that are hooked up to different datatables in a SQL server. Some of these tables are VERY large -- several million+ records. The tables have records that are timestamped over several years and months/quarter/weeks... depending on the individual table they can have anywhere between 30 and 300 geography/time combinations. What I would...
5
4051
by: Homa | last post by:
Hi all, Can anyone give me some links about how to do an async web service call from aspx and display a temperary page before the web service returns? Thanks, Homa Wong
2
1543
by: Leneise44 | last post by:
Does the new async features within asp.net 2.0 and ado.net 2.0 render the async application block (1.1) extinct? What would be the advantages of using the async application block with 2.0? Seems like a lot less code can be written using 2.0 that threads safely and quickly.
1
2285
by: jonathan | last post by:
I need to create a webpage that asynchronously loads a series of user controls onto a page. If the user control take longer than X seconds to load it should display an error message in it place. The rest of the page should continue to load whilst the seperate user control threads are loading. What is the correct way of doing this? I've created a delegate for loading the user control sand called
6
2983
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, We have two sites hosted on different servers and we have many pages on domain A which has many links(asp programs) to domain B. My question is if domain B server is in trouble, what is the best way to have all domain pages redirect to domain A? Right now I just have redirect code in each program on domain B to redirect to a maintenance page on domain A. Can I just write on program to solve this issue? Thanks.
1
4055
by: robert112 | last post by:
Question... Can one not use ThreadPool.QueueUserWorkItem with an anonymous method like so: ThreadPool.QueueUserWorkItem(delegate { //perform IO bound operation. }); Why did the asp.net team create the directive async=true way of creating async pages???
2
4009
by: Norm | last post by:
The error that pops up in a JS alert box is: Sys.WebForms.PageRequestManagerParserErrorException: The message from the server could not be parsed. ... "<DOCTYPE ..." I have three update panels and a couple of AJAX toolkit extenders on the page. The button that causes the problem is simply sending an email then redirecting to a "Thank You" page. There are two update panels that are both set to conditionally trigger on that button...
0
9529
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
10457
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9054
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
7550
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
6792
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
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4119
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
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2927
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.