How to create threads in ASP.NET pages from the CLR thread pool instead of the ASP.NET pool?

If I create a new thread on an ASP.NET page, the property IsThreadPoolThreadis true. First question: is it from an ASP.NET pool or CLR pool? Second question: if it is from an ASP.NET pool, then how to create a stream from the CLR and not use the ASP.NET pool? I need a synchronous solution for long queries ( full story ).

+3
source share
3 answers

First, there is no difference between an ASP.NET thread pool and a CLR thread pool. ASP.NET processes pages in the CLR thread pool, so your ASP.NET pages will always have IsThreadPoolThread == true.

I am curious how you create your stream. Are you using the System.Threading.Thread constructor or using ThreadPool.QueueUserWorkItem? If you are using ThreadPool.QueueUserWorkItem, then the streams you receive come from a regular .net thread pool.

, , ASP.NET. - , ASP.NET . , IIS: http://csharpfeeds.com/post/5415/Dont_use_the_ThreadPool_in_ASP.NET.aspx

+8

, , , IIS , . " ", .

, IIS , , . , IIS ( -). , ( IIS 0.001ms )

, IIS , IIS , , , -, , , . , Asynchronous Handlers (ASHX), IHttpAsyncHandler, , , - . , , asp.net . , 100 , , , - , :). , , ( , ):

-

+4

ASP.NET: Worker IO ( , , , CLR).

ASP.NET , , ; ​​ IIS. ASP.NET , , . - - .NET:)

, , , : new Thread().... .. , . , , asynch .NET. , asynch SQL, webservice .. BEGIN END. , , IO.

ASP.NET , . :

  • : . , .
  • Asynchronous page tasks: this allows you to define tasks that will run asynchronously when the page starts. Its kind of like Asynch threads, just that ASP.NET does a lot of things for you, and its more limited.

I don’t have all the details, but check out the two options in the MSDN library. Here is an article on this topic: asynch programmin

+2
source

Source: https://habr.com/ru/post/1771147/


All Articles