Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I update ASP.NET Core app over an existing/running site without stopping the web server?

Tags:

We have an ASP.NET Core site running on our test server that we would like to auto-deploy by XCopy to our IIS web server as we do our current apps, where I already have the site running. I've added a publish profile that packages the site to a "publish-local" directory within the solution. Whenever I try to copy over the existing site, all DLLs are being used by another process, presumably Kestrel, so I am forced to deploy to a sibling directory and re-map IIS to look at the sibling. How does one update a running ASP.NET Core site without having to manually intervene and stop either the Kestrel or IIS web servers?

like image 396
flipdoubt Avatar asked Dec 14 '16 16:12

flipdoubt


People also ask

How do I update my ASP.NET Core app?

To check, right click on dependencies and choose manage NuGet Packages. And in the update tab, you'll see a list of packages which are available for updates. Like in this case, there is an update available for the “Microsoft. AspNetCore.


2 Answers

When running with IIS you can drop a file called app_offline.htm (case sensitive) to your application folder. IIS will stop your application and will serve the contents of the app_offline.html file. Now you can copy your application. Once finished remove the app_offline.html and IIS will start your app. This is described in the docs and also in my post on running Asp.NET Core apps with IIS.

like image 113
Pawel Avatar answered Nov 09 '22 05:11

Pawel


a little cheat we use is to rename the old files first (something like my.dll.old), then copy over the new dlls. Then you can either force or wait for an app pool restart.

like image 29
Mike_G Avatar answered Nov 09 '22 03:11

Mike_G