Upgrade from ASP.NET Core 2.1 to 2.2 and the IIS InProcess Hosting Model

ASP.NET Core 2.2 recently came out and the one thing that caught my attention was the new IIS InProcess Hosting Model.  I saw the demo during this week's Community Standup and couldn't help but agree that this could be a big help to development efficiency.  As web developers we all do build solution and refresh browsers a lot and any improvement to shorten the time between making a change and seeing that change is welcoming.

So I followed the migration guide, upgraded my blog from 2.1 to 2.2 locally (at the writing of this post this site is not updated yet). The upgrade was surprisingly easy compared to last time when I upgraded from 2.0 to 2.1, that was a lot more changes needed.

Here are things I did to upgrade to v2.2

  1. Install the 2.2 SDK.
  2. Update all .csproj files (class libs, web and test projects) TargetFramework from netcoreapp2.1 to netcoreapp2.2
  3. For the Fan.Web.csproj, also add <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>.  This is the new IIS in-process hosting model that will make development more efficient.
  4. Update Startup.cs CompatibilityVersion.Version_2_1 to CompatibilityVersion.Version_2_2
  5. After that I built my solution and found one incompatibilities with a nuget package and I ended up updating all nuget packages to latest and everything worked fine from that point.

To try the IIS InProcess Hosting Model, first I made sure my site is running in-process with IIS Express after upgrading to ASP.NET Core 2.2 by looking at the Process Explorer.  As you can see my DLLs are listed under the IIS Express process.

Process Explorer showing my DLLs in process with IIS Express and ASP.NET Core 2.2
Process Explorer showing my DLLs in process with IIS Express and ASP.NET Core 2.2

Then I tried to load my site on localhost with OutOfProcess, it took about 6.5 seconds and after that InProcess and only took about 4 seconds.

As noted by the migration guide the VS auto build does not currently work with InProcess.  Remember how we could update C# code and then just refresh the browser and see our changes, now with v2.2 InProcess if we make a code change then we have to do a manual build.  Honestly I'm OK with that.  Razor changes are still automatically picked up and there is performance improvements there as well.