question

bhavna-3740 avatar image
0 Votes"
bhavna-3740 asked Bruce-SqlWork answered

what exactly is the ASP.NET Core 5 host?

After the build, inside the bin folder, there are 2 main files {AppName}.exe and {AppName}.dll, what I understand is AppName.dll is the actual compiled application Code and AppName.exe is the host who hosts the App inside Kestral.
My question is, is this ".exe" is due to the Program.cs, and is it the one that acts as a worker process under which our application runs because we get the process name as Application name for ASP.NET Core 5 and not dotnet (dotnet.exe) anymore.
And if I am not wrong the application itself acts a the worker process to run the application code?

dotnet-aspnet-core-general
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,@bhavna-3740,
As you said,if you execute AppName.exe,it will launch the Kestrel web server.

0 Votes 0 ·

yes, it will. I just don't understand what is within what? means Kestral resides within our app or our app runs within Kestral, it is so confusing.
The image that Microsoft uses, shows that Kestral is within our app and the application code+kestral is wrapped inside application.exe (previously dotnet.exe).

0 Votes 0 ·

1 Answer

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

any .net core app is a dll, that you run with the dotnet.exe.

dotnet run myapp.dll

the exe is lightweight version of dotnet.exe renamed to your app name. its job is to load and run the .net core dll (matching its name). This is the .net IL host/bootstrapper which contain the jit compiler and the .net core IL vm.

Kestrel is a library included in the .net runtime packages. The host builder in program.cs will look at the args and configuration values to determine if Kestrel will host the pipeline or another library will be used.

again the Kestrel magic is all done by the builder pattern used to configure the program at startup.

https://en.wikipedia.org/wiki/Builder_pattern

note: the old .net framework needed an IL host, but MS updated the windows O/S to detect that an exe was a .net exe and magically used a IL host (which contains the jit compiler). Because .net core is cross platform, this was not done.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.