Using Task or async/await in IHttpAsyncHandler

后端 未结 6 842
名媛妹妹
名媛妹妹 2020-12-23 12:22

Since the very begining of writing ASP.NET applications when I wanted to add a threading there are 3 simple ways I can accomplish threading within my ASP.NET application :

6条回答
  •  甜味超标
    2020-12-23 13:12

    Saying that "0 (zero) threads will be servicing this request" is not accurate entirely. I think you mean "from the ASP.NET ThreadPool", and in the general case that will be correct.

    When async/await will not consume an additional ThreadPool thread? Only in the case you are using BCL Async methods (like the ones provided by WebClient async extensions) that uses an IOCP thread to execute the IO bound operation.

    If you are trying to async execute some sync code or your own library code, that code will probably use an additional ThreadPool thread unless you explicitely use the IOCP ThreadPool or your own ThreadPool.

    Thanks, Andrés.

提交回复
热议问题