Search code examples
.netasp.net-coreiis-8

IIS Publish ASP.NET Core App Without Bringing Down IIS Website


Current Setup


We currently deploy our ASP.NET Core products to:

  • Windows Server 2016
  • Hosted on IIS Version 10.0.14393.0

We have a single "Site" with multiple applications under it. Each application uses its own application pool and is mapped to a different physical folder path location.

Each application is represented by its own source code ASP.NET Core Server project

IIS Structure

IIS Structure of child Apps in Site

The Problem


We use Jenkins for our CI/CD, and this cannot be changed. We have Powershell scripts to interact with IIS

There is no IIS command to stop an Application, only a Site, but we ideally do not want to bring down the site when publishing a new version of a single Application. We only want to bring down that specific Application.

We attempted this by stopping the WebAppPool associated with the application, and then waiting (2 minutes .. then 5 minutes). But even after that the application files are still locked.

We end up shutting down the WebAppPool and the Site to release the files so they can be replaced.

I know there has to be a better way to do this. How can we shut down an individual app, and prevent new requests from reaching it so we can replace the files and then restart it? All while the "SITE" and any other App under it not being updated is still running. I don't mind down time for the App being updated.

Update 6/8/2022

Found this: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/app-offline?view=aspnetcore-6.0

Going to see if this can solve my problem.


Solution

  • Adding a file named app_offline.htm in the root folder of your application should force ASP.NET Core Module to shutdown the app and stop processing incoming requests. You should then be able to deploy new file with no impact on the the other applications.