Publishing a dotnet application that's already running

The best way is to drop an app_offline.htm file to your application folder. This will make IIS stop your application and serve the contents of the app_offline.htm file to the user while you are copying the new version. Once you complete copying the new version of your application remove the app_offline.htm file and IIS will start your application. You can find more details on running ASP.NET Core applications with IIS in my post.