简体   繁体   English

Global.asax Application_Error是异步吗?

[英]Is Global.asax Application_Error async?

I need to handle requested file missing with complex longworking logic. 我需要处理复杂的longworking逻辑所缺少的请求文件。

I can do it in Application_Error but not sure if it is async itself or not? 我可以在Application_Error执行它但不确定它本身是否异步?

Will this handler block other users for all time, if it take for example 5 minutes or more to work? 这个处理程序是否会一直阻止其他用户,如果需要5分钟或更长时间才能工作?

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. 它所参与的页面处理的Application_Error是从你加载的页面调用的,所以问题是Page或者处理程序是否是异步的。

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 如果您不使用会话,当然如果您不使用其他同步锁,如mutex或数据库打开/读/写

Why is that ? 这是为什么 ? because session is locking the full processing, look at this question/answer: call aspx page to return an image randomly slow 因为session是锁定完整的处理,看看这个问题/答案: 调用aspx页面随机返回图像慢
ASP.NET Server does not process pages asynchronously ASP.NET Server不会异步处理页面
Trying to make Web Method Asynchronous 试图使Web方法异步
Web app blocked while processing another web app on sharing same session 在共享同一会话时处理另一个Web应用程序时阻止了Web应用
What perfmon counters are useful for identifying ASP.NET bottlenecks? 什么perfmon计数器可用于识别ASP.NET瓶颈?
Replacing ASP.Net's session entirely 完全取代ASP.Net的会话
File upload and result pooling kills ASP.NET web app 文件上传和结果池会杀死ASP.NET Web应用程序

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. 因此,为了简单起见, Application_Error只是一个静态函数调用,但它连接到页面或处理程序的处理。 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. 另一方面,处理5分钟,如果您尝试将500个一起放在查询列表中,则可能还有其他问题。

I just make a simple test, place System.Threading.Thread.Sleep(20000); 我只做一个简单的测试,放置System.Threading.Thread.Sleep(20000); on Application_Error and make an error, and continues to load other pages, and works. Application_Error发生错误,并继续加载其他页面,并且正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM