What is the point of setting "No Managed Code" .NET CLR version for an IIS Asp.NET Core application pool?
Documentation says that
ASP.NET Core runs in a separate process and manages the runtime. ASP.NET Core doesn't rely on loading the desktop CLR. Setting the .NET CLR version to No Managed Code is optional.
Since it is optional, what are the drawbacks of keeping the default v4.0? Why the documentation explicitly instructs to set it to "No Managed Code"? It's not very clear whether there are performance concerns around this particular configuration.
The Common Language Runtime (CLR), the virtual machine component of Microsoft . NET Framework, manages the execution of . NET programs. Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instructions which are then executed on the CPU of the computer.
Core CLR. The Common Language Runtime for . NET 5 (and . NET Core) and later versions.
The CLR allows an instance of a class written in one language to call a method of a class written in another language. It also provides garbage collecting (returning unneeded memory to the computer), exception handling and debugging services.
NET, Framework is known as unmanaged code. Applications that do not run under the control of the CLR are said to be unmanaged, and certain languages such as C++ can be used to write such applications, which, for example, access low - level functions of the operating system.
When you specify .NET CLR version as 4.0 for an application pool, IIS loads into its worker processes some ASP.NET supporting libraries (like aspnet_isapi.dll
for classic pipeline mode, and webengine4.dll
for integrated mode). Such increases memory usage and attack surface, and might also have other impact.
Therefore, if you only run non-ASP.NET 4.x apps (PHP, ASP.NET Core and so on), you can set "No Managed Code" to remove all the troubles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With