Using tasks/ ThreadPool on IIS application (asp .net)

余生长醉 提交于 2019-11-29 08:48:32

The ASP.NET host provides a single thread pool per process. So if you're using ThreadPool, then it's taking from the same pool that is drawn from for server requests.

That said, if you're starting background operations that are independent from a single client request, then you should be using a Win32 service, web service, message queue system, or something similar. Running "background" threads in ASP.NET goes against the entire architecture of IIS; it's much easier to scale properly and do other IT work (e.g., restarting app pools) if you maintain the stateless nature of HTTP.

Task, still consumes threads from thread pool.

As far, as I understood you question, 3rd party service performs CPU-heavy calculation, and you need asynchronously wait it to complete.

In case, if you want to postpone page rendering, until computation is complete, Async pages will help. This approach will return processing thread to thread-pool, while waiting.

Could you provide more details about required solution, for more precise answer?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!