locked
How do I use -enableRule:AppOffline in deploy.cmd? RRS feed

  • Question

  • User16290778 posted

    I create package:

    msbuild myapp.csproj /T:Package /p:PublishProfile=myprofile;PackageLocation=mypackage.zip

    Try to deploy:

    mypackage.deploy.cmd /Y -allowUntrusted /U:user /P:pass /M:myserver -enableRule:AppOffline

    -enableRule:AppOffline is totally ignored and I get no errors. I also tried with -enableRule:AppOfflineblahblahblah and same thing so its not even trying to validate the argument.

    I want to use the script so I don't have to build a webdeploy command manually but how do I get -enableRule:AppOffline to work?

    Edit: This is the msdeploy command that it generated and ran:

    msdeploy.exe -source:package='myPackage.zip' -dest:auto,computerName="myserver",userName="****",password="****",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\....\myapp\mypackage.SetParameters.xml"  -allowUntrusted -enableRule:AppOffline

    So I was wrong, looks like it is adding the arg to webdeploy and webdeploy is the one ignoring it.

    I know its being ignored because I see this error:

    ....
    Error Code: ERROR_FILE_IN_USE
    More Information: Web Deploy cannot modify the file 'u_extend1_x.log' on the destination because it is locked by an external process.  In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. ....
    Wednesday, March 28, 2018 4:14 PM

All replies

  • User283571144 posted

    Hi red888,

    As far as I know,  Web Deploy takes an application offline by using the "AppOffline" rule, which is off by default. 

    Article:https://docs.microsoft.com/en-us/iis/publish/deploying-application-packages/taking-an-application-offline-before-publishing 

    More Information: Web Deploy cannot modify the file 'u_extend1_x.log' on the destination because it is locked by an external process.  In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. ....

    According to the error message, it means other process has locked the 'u_extend1_x.log' file.

    I guess the msbuild doesn't start since the 'u_extend1_x.log' is in use, so you will feel the enableRule:AppOffline is useless.

    I suggest you could try to use process monitor to find the process which lock the 'u_extend1_x.log' .

    Then you could kill that process and re-deploy again.

    Best Regards,

    Brando

    Thursday, March 29, 2018 9:12 AM
  • User16290778 posted

    I know the file is locked but why? I literally never see this with DeployOnBuild, whats different about that, that makes it never fail on a locked log file? Also, app offline is supposed to solve problems like this but its not

    Wednesday, April 4, 2018 7:48 PM