-->

How to update a running asp.net core application?

2020-07-16 08:17发布

问题:

I have a Asp.Net Core MVC application running on Windows Server 2008 R2 with IIS. But every time I update this application, I need to manually stop the applicationPool in IIS, and restart the applicationPool after I finish updating the app. Otherwise it will tel me "the xxx.dll is in use by other progress".

Is there any way to make this process easier?

回答1:

Finally I found my anwser:
I just need add a file named app_offline.htm to the IIS web root(not your project wwwroot folder). due to this issue you may need try both App_Offline.htm or app_offline.htm .



回答2:

Opening the web.config file in an editor and saving it will cause the web application to reload, even if you don't change anything. All DLLs should be replaceable, until a user hits the site, causing the web application to start again. I sometimes use that as a workaround.

A more full fledged solution would be to use Web Deploy, either through Visual Studio or by command line. This can take a litte while to set up, but offers more automation.

https://docs.microsoft.com/en-us/aspnet/core/publishing/iis#deploy-the-application-1



回答3:

There is no way to hotswap in place DLL's.

Your best bet is to deploy to a new folder each time (For example a versioned folder), and change the website directory in IIS once you have fully copied your website onto the server.