dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.21k stars 9.95k forks source link

How to replace web files in use in iis #1617

Closed anobaka closed 8 years ago

anobaka commented 8 years ago

Our company used to use git to publish websites(.net 4, mvc 3) to remote cluster by targeting website folder to git folder on servers. After I upgraded a project to asp.net core and published it to iis, the web files can not be updated by git because there is always some files(e.g. myweb.exe, myweb.dll) are in use, so the old 'git publish' way can not be modify these files. There are plenty of works to do by using vs's webdeploy to every server machine and it's lack of some functions like 'rollback', any suggestions? Thanks.

Tratcher commented 8 years ago

Have you tried the app_offline.htm file/feature? If you push a file with that name first it will cause the site to shut down.

anobaka commented 8 years ago

@Tratcher Thank you for the answer! It works ! but I have to take one step more than old way: old way(netframework 4 website): publish files to git repository and run git pull in remote servers, it will be success because all files can be modified or repleaced without using the app_offline.htm file, new way(asp.net core website): add app_offline.htm to git repository and run git pull in remote servers, and after the content of app_offline.htm shows up on my browser(It takes a few seconds, is iis trying to stop running myweb.exe?), I remove app_offline.htm in my git repository and do what I do in old way is there a better way to deploy my web projects to cluster servers? I'm using some features of asp.net core but using net452 framework in project.json

Tratcher commented 8 years ago

@shirhatti @glennc ?

shirhatti commented 8 years ago

Sounds like what you're trying is easily achievable by running a script that perhaps drop an app_offline.htm page before performing a git pull. Perhaps just carry a deployment script along with your published project and execute that instead of a git pull.

Unless, of course I misunderstood and your git server is your deployment server. In that case, I'd recommend using a server-side git hook.

If you are not set on using git as your deployment technology, you could perhaps use something that works better with app_offline.htm. For one, I know that WebDeploy supports app_offline.htm, you just have to use the enableRule:AppOffline parameter.

anobaka commented 8 years ago

@shirhatti Thanks ! I'm setting on using jenkins and msdeploy to do that.