When you deploy a Web app on IIS using the. Netcore Update, you find that the file is locked and cannot be overwritten as it was previously non-core, the following are the methods I use to solve this problem.
You can also refer to Microsoft's official documentation
Https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.0&tabs=aspnetcore2x
There are several methods:
The simplest is to stop the website and update it.
Because I'm too lazy to feel that way every time I write a script (according to the first form of official offer)
1. Create the following files in an empty directory, respectively
The release directory is used to put files that are ready for updating, and usually the VS release is copied.
App_offline.htm This file is used for updates if someone visits the site display content, only the content of their own writing on the line, afraid of trouble directly write "site maintenance ..." can also
Update.bat the script used to perform the update is as follows
@echo Offset updatepackrootpath=e:\ Site Deployment \mvcmovie_updatepackset updatewebpath=e:\ Site Deployment \mvcmovie Set Offlinefilepath=%updatepackrootpath%\app_offline.htmset Updatesourcepath=%updatepackrootpath%\releaseecho * * * echo * Please confirm the following update message echo * Update package path:%updatepackrootpath%echo * Update target path:%updatewebpath % echo * Press any key to start update echo ******************************************pauseecho start Update call xcopy%offlinefilepath%% updatewebpath%/s/q/y/icall xcopy%updatesourcepath%%updatewebpath%/s/e/q/y/idel%updatewebpath%\app_offline.htme Cho Update complete pause
The above "Updatepackrootpath", "Updatewebpath" two variables to change the value of your own corresponding to the subsequent execution of this bat can be automatically updated.
Lazy to build their own can be downloaded to change the bat inside the above mentioned two variable values can be.
Https://files.cnblogs.com/files/nekoyzx/UpdatePackTool.zip
. netcore MVC Update when files are locked out of the way