How to update a running asp.net core application on Windows?

John picture John · May 13, 2017 · Viewed 7.9k times · Source

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?

Answer

Bharat Vasant picture Bharat Vasant · Mar 11, 2021

A workaround For Windows with no down time and I am regularly using is:

  1. Rename running .NET core application dll to filename.dll.backup
  2. Upload the new .dll (web application is available and serving the requests while file is being uploaded)
  3. Once upload is complete recycle the Application Pool. Either Requires RDP Access to server or function to recycle application pool in your hosting control panel.

IIS overlaps the app pool when recycling so there usually isn’t any downtime during a recycle. So requests still come in without every knowing the app pool has been recycled and the requests are served seamlessly with no downtime.

I am still searching for more better method than this..!! :)

January 2022 - for Linux

For Linux, we use Openresty nginx with Lua script to hold (sleep) incoming requests for few seconds until the service running .NET Core or .NET 5 or .Net 6 application restarts and then we release the threads we had hold.

Refer: https://github.com/basecamp/intermission