Sunday, 23 August 2015

Take Azure Web Application Offline – While Deploying with VS Release Management

You may encounter below error while deploying a Web Application to Azure via RM Server.
*******************************************************************************************************
Info: Adding sitemanifest (sitemanifest).
Info: Deleting file (xxxxxxxxxx\webapp-log.txt).
Warning: An error was encountered when processing operation 'Delete File' on 'we
bapp-log.txt'.
Retrying operation 'Delete' on object filePath (xxxxxxxxxxxxx\webapp-log.txt).
Attempt 1 of 5.
Warning: An error was encountered when processing operation 'Delete File' on 'we
bapp-log.txt'.
Retrying operation 'Delete' on object filePath (xxxxxxxxxxxxx\webapp-log.txt).
Attempt 2 of 5.
Warning: An error was encountered when processing operation 'Delete File' on 'we
bapp-log.txt'.
Retrying operation 'Delete' on object filePath (xxxxxxxxxxxxx\webapp-log.txt).
Attempt 3 of 5.
Warning: An error was encountered when processing operation 'Delete File' on 'we
bapp-log.txt'.
Retrying operation 'Delete' on object filePath (xxxxxxxxxxxxx\webapp-log.txt).
Attempt 4 of 5.
Warning: An error was encountered when processing operation 'Delete File' on 'we
bapp-log.txt'.
Retrying operation 'Delete' on object filePath (xxxxxxxxxxxxx\webapp-log.txt).
Attempt 5 of 5.
Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'webapp-log.txt' on the dest
ination because it is locked by an external process.  In order to allow the publ
ish operation to succeed, you may need to either restart your application to rel
ease the lock, or use the AppOffline rule handler for .Net applications on your
next publish attempt.
  Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE
.
Error: I/O error occurred.
Error count: 1.

*******************************************************************************************************
How to resolve
To resolve above issue it is required to set the rule to take web application offline while deploying with web deploy.
-enableRule:AppOffline

Should be set in the Web Deployment component in the RM server template.

image

With this change web application is taken offline while the deployment happens.

image

Change made to default page and checked in.

image


Build and Release.

image

image

Site under construction (Taken offline)

image

Deployment done.

image

image



No comments: