I recently switched from OutOfProcess to the InProcess hosting model in my web.config file. How can i inspect that i did it the correct way? How can i see what the hosting model is of sites within IIS?
Here is a way you can get info about the hosting model, albiet indirectly. Anywhere you have access to an HttpContext
object, for example in a controller, you can do this:
IServerVariablesFeature serverVars = HttpContext.Features.Get<IServerVariablesFeature>();
if (serverVars == null) {
//IIS Version not available probably because site is running out of process.
} else {
//Site appears to be running under IIS
string iisVersion = serverVars?["SERVER_SOFTWARE"];
string appPoolId = serverVars?["APP_POOL_ID"];
}
At that top of that file you need this using statement using Microsoft.AspNetCore.Http.Features;
You can learn more about IIS server vars here: https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524602(v=vs.90)?redirectedfrom=MSDN