ASP.NET Core 2.2 Site Warmup
NickName:pseabury Ask DateTime:2019-08-28T00:56:13

ASP.NET Core 2.2 Site Warmup

I've migrated a .NET Framework 4.6 WebApi to .NETCore 2.2 and am having trouble getting the IIS ApplicationInitialization module to call my endpoints on a startup/slot swap/scale out.

I added a Web.Config like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\FR911.Api.Core.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />

      <applicationInitialization doAppInitAfterRestart="true">
        <add initializationPage="api/Warmup>
        <add initializationPage="/" />
      </applicationInitialization>
    </system.webServer>
  </location>
</configuration>

But if I keep the default hosting model of "inprocess" my warmup never gets called. If I change to "outofprocess" hosting, my warmup does get called before the swap is completed.

I think the issue below is likely related:

https://github.com/aspnet/AspNetCore/issues/8057

I'm not looking to just manually ping or otherwise hit my endpoint because I want the existing feature in the module that IIS is Azure won't actually swap the endpoints until the warmup requests have finished (thus initing EFCore etc.)

Has anyone had any luck getting this to work with the inprocess hosting model?

Copyright Notice:Content Author:「pseabury」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/57679221/asp-net-core-2-2-site-warmup

More about “ASP.NET Core 2.2 Site Warmup” related questions

ASP.NET Core 2.2 Site Warmup

I've migrated a .NET Framework 4.6 WebApi to .NETCore 2.2 and am having trouble getting the IIS ApplicationInitialization module to call my endpoints on a startup/slot swap/scale out. I added a ...

Show Detail

ASP.NET warmup/initialize

I'm trying to eliminate (or at least minimize) startup/warmup times for my .NET applications. I'm not really sure on how to do this even though it's a common concern. There's a ton of questions ab...

Show Detail

Problem in Building Project in Asp.net Core 2.2

I'm facing a problem of building a project of ASP.NET core 2.2 in visual studio 2017. Please Note that I'm successfully able to build and run project in ASP.NET core 2.1 . I have installed asp.net ...

Show Detail

Migrating from ASP.NET Core 2.2 to 3.1

We currently have an ASP.NET Core 2.2 web app that we would like to migrate to 3.1 (as it's newer and contains several enhancements). There are articles on migrating from 2.2 to 3.0 but not 2.2 to ...

Show Detail

AddJsonOptions for MvcJsonOptions in Asp.Net Core 2.2

I have read this question and this one about AddJsonOptions in older version (2.0 and 2.1 respectively). I'm Using Asp.net Core 2.2 but there is not such method of AddJsonOptions under services. I...

Show Detail

Asp.Net Core 2.2 change database run-time by current user

I have an ASP.NET Core 2.2 project using EF Core that is used by multiple customers. Each customer has their own database with the exact same schema managed by IRepository (Dynamically loaded DBset...

Show Detail

Where is the ASP.NET Core 2.2 temp-directory in?

For ASP.NET MVC5 (.net4.8) the ASP.NET temporary directories are: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Tempor...

Show Detail

Using autofac in asp.net core 2.2

I am trying to use latest Autofac with asp.net core 2.2 project. However documentation of autofac seems to be outdated. I am trying to use autofac without ConfigureContainer: // ConfigureServices is

Show Detail

Upgrade Autofac Multitenant with ASP.NET Core 2.2 to ASP.NET Core 5

I have an ASP.NET Core 2.2 application that is currently using following dependencies: Autofac.AspNetCore.Multitenant version 1.1.0 Autofac.AspNetCore.Extensions version :1.0.2 I want to upgrade ...

Show Detail

How to get all login users sessions in Asp.Net Core 2.2?

I have site on Asp.Net Core 2.2 using Sessions. Is there any way to get all users sessions, and all login users and iterate them? Also break session for some user, if he is banned.

Show Detail