Written by Mark Pringle | Last Updated on Wednesday, November 30, 2022

IIS ASP.NET Version: 6.0 General Information

Microsoft IISWhen publishing an ASP.NET Core application to Internet Information Services (IIS), you may encounter problems deploying it while the website is running or live on IIS.

If you make changes to a website in your development area and then try to publish it to IIS while the website is online, you will notice that the deployment is not successful. Publishing fails while the web application is running on IIS. Why? Specific files on IIS become locked while in use and cannot be altered or deleted while the application runs. These locked files present a significant problem when updating a website.

I have had this situation occur often and have had to shut down the website during deployment using the app_offline.htm file. Temporarily shutting down a website is not an acceptable solution because your web application will be unavailable to users.

In .NET 6, something called Shadow Copying for IIS deployments is supposed to overcome this obstacle.

Shadow Copying for IIS deployments causes all assemblies in the application path to be copied to a download cache or custom location of your choice before loading them.

Here's more information about enabling and using Shadow Copying for IIS deployments.