0
votes

I have created a ASP.NET Core Web Application (.Net Framework) in Visual Studio. I publish the project to Azure with Web Deploy using publishing profile. It throws error as mentioned below:

"Severity Code Description Project File Line Suppression State Error Web deployment task failed. (Web Deploy cannot modify the file '.exe' 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.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.)
"

What is the cause of this type of issue?

I tried "MSDEPLOY_RENAME_LOCKED_FILES=1" as well as "AppOffline rule handler for .Net applications ", but its not working. Please help to get rid of such type of bug.

1

1 Answers

0
votes

In this wiki doc, there are detailed solutions to Prevent files from being locked.

  • Run from a package
  • Stopping the site before deploying
  • Enabling 'App Offline'
  • Rename locked files
  • Check read-only attribute

For your situation, i suggest you restart or shut down your app to release the lock. And App Offline actually is a way to shut down app.(If you have other problems with App Offline please check this so question)

If you use App Offline mode, make sure your app_offline.htm file is at least 512 bytes long.