Search code examples
iisasp.net-coreweb-deploymentwebdeploy

Webdeploy from commandline not taking app offline even with -enableRule:AppOffline


When I try to run this command from commandline to deploy asp.net core website:

"C:\\Program Files\\IIS\\Microsoft Web Deploy V3\\msdeploy.exe" -allowUntrusted -verb:sync -sourc
e:contentPath="%USERPROFILE%\ProjectFolder\bin\release\netcoreapp1.1\publish" -dest:contentPath="sitename",ComputerNa
me="https://siteurl.com:8172/msdeploy.axd?site=sitename",UserName='myusername',Password='mypassword',AuthType='Basic' -enableRule:AppOffline -retryAttempts:20

Get this error:

Error Code: ERROR_FILE_IN_USE

When I stop website on web server, then deployment succeeds:

I was expecting -enableRule:AppOffline should force website offline. But it still keeps the lock on website dll.

How we can force webdeploy to overwrite files?


Solution

  • Can you see on the site if the App_Offline.htm is being created? If yes, try renaming to app_offline.htm (all lower case). Does that shutdowns the site? There is bug in AspNetCoreModule for App_Offline.htm file being case-sensitive, see here.