3

I need to handle requested file missing with complex longworking logic.

I can do it in Application_Error but not sure if it is async itself or not?

Will this handler block other users for all time, if it take for example 5 minutes or more to work?

Arpit
  • 6,212
  • 8
  • 38
  • 69
IntellyDev
  • 131
  • 1
  • 5

1 Answers1

0

The Application_Error its take part of the page processing, is called from the page that you load, so the question is if the Page or the handler is asynchronous its self.

It is, if you not use session, and of course if you do not use other synchronization locks, like mutex, or database open/read/write

Why is that ? because session is locking the full processing, look at this question/answer: call aspx page to return an image randomly slow
ASP.NET Server does not process pages asynchronously
Trying to make Web Method Asynchronous
Web app blocked while processing another web app on sharing same session  
What perfmon counters are useful for identifying ASP.NET bottlenecks?  
Replacing ASP.Net's session entirely  
File upload and result pooling kills ASP.NET web app

So to make it simple, the Application_Error is just a static function call but is connected to the processing of the page or the handler. Make sure that the page or the handler are not block each other, and all is ok.

From the other hand, a processing of 5 minutes, if you try to make 500 of them together and not place them on a query list, you may have other problems.

I just make a simple test, place System.Threading.Thread.Sleep(20000); on Application_Error and make an error, and continues to load other pages, and works.

Community
  • 1
  • 1
Aristos
  • 66,005
  • 16
  • 114
  • 150
  • My problem is: I must perform longworking async operation not for .aspx page, but for requested static url of absent file which has to be generated. In case of aspx.page I could do the following: set <%@ Page Async="True" and call method AddOnPreRenderCompleteAsync(BeginAsyncOperation, EndAsyncOperation); should I redirect to special async page from Application_Error method? Or call all longworking method directly right from Application_Error ? – IntellyDev Dec 20 '12 at 09:38