P
P
Popou2022-01-28 09:49:35
ASP.NET
Popou, 2022-01-28 09:49:35

Does Asp.Net always work?

I just started learning Asp.Net and I'm wondering if Asp.Net Core is always running? What I mean is, in the same php, the request just runs the script, but what about asp.net? Does each request start a separate process, or is it all one process that handles all requests?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2022-02-02
@Popou

It not only works "always", but has several modes of operation. You can deploy the application as an IIS module, or make it stand alone. The first option, in turn, is divided into two: "classic" and "integrated".
1. Classic implies that IIS loads the DLL ISAPI module, which in turn starts the NET environment in a separate thread. So even in this case ASP NET CORE (or earlier ASP NET ) works "always". (As opposed to just ASP which was before NET). Despite the fact that in the pictures in the documentation, processing begins only with the arrival of a request, there is still a process and a thread responsible for the work of ASP NET. It runs global.asax. But this process can be restarted by IIS at any time if it "doesn't like" at least something (including, for example, that the process was started too long ago. Some of these parameters are available for change in the IIS application pool)
2. In integrated mode, everything is about the same, with the exception that there the NET environment is already part of the IIS pipeline and the application has the ability to process more events. Since this is now part of IIS, the normal completion will be to unload the application domain from memory. But since this may not be possible for various reasons, IIS can still restart the process along with the entire application pool. Normally this doesn't happen in normal mode. However, here it is necessary to make a remark:
If the term "always works" means the launch of some kind of background task in a separate thread, then there are nuances. For old ASP NET this is documented in this blog haacked.com/archive/2011/10/16/the-dangers-of-impl...For ASP NET CORE, Microsoft made an effort and expanded both the very possibility of correctly launching background tasks and the documentation: https://docs.microsoft.com/en-us/aspnet/core/funda...
And here it should be noted that no one It doesn’t hurt to just start a new thread on your own, but this is not a regular job and is fraught with all the same consequences as described in that blog.
3. Stand alon mode is more simple. It is a standalone NET console application that runs a Kestrel HTTP server internally. But in comparison with IIS, I would call it a "underserver", because not only does it lack most of the IIS functions, but also the documentation is lame. But still, even despite this, it is in many ways better than IIS due to its simplicity. In addition, it is a no-alternative solution if your application must run in a docker container or on an OS other than Windows, where IIS has not yet been delivered. Since this is a separate application, you can run as many threads as you like there and this should not lead to the described problems. But it's still better to use regular tools. At least for the purpose of application portability between IIS and stand alone modes.

L
Leonid, 2022-01-28
@caballero

and what difference does it make to you what process there is,
on request, the method of the addressable controller is triggered and all
PHP frameworks also work this way through echo no one displays data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question