Reputation: 1394
I have a web application that I'm publishing to an Azure website. Sometimes it will publish with no issues. However, more often than not it will fail on a particular binary file (one of the business logic dlls) stating that the file is in use. After a quick google; it seems this means the file is in use on the server side. Which is odd as there are certainly no requests occurring against this web app at the time.
Is there some configuration option I need to set somewhere to force unloading of dlls? I've published Azure websites before and never seen this.
Upvotes: 4
Views: 3060
Reputation: 603
Apparently the App_Offline.htm
file that gets uploaded to your server while the publishing happens should actually be named app_offline.htm
(i.e. lowercase). The system not recognizing the file in a case insensitive way is a bug (recognized at some point in this GitHub issue).
So if adding <EnableMSDeployAppOffline>True</EnableMSDeployAppOffline>
to your .pubxml
file doesn't work, and neither does restarting the Azure web app, try renaming App_Offline.htm
to app_offline.htm
on the server (and possibly publishing again). It should work.
PS: This bug was supposedly fixed in .NET Core in January 2017 (see the linked issue), but I couldn't figure out if the problem was the .NET version in Azure or in the upload PC, or something else (this thread didn't help me). In the meantime it seems like the problem is indeed fixed since it never happened to us again.
Upvotes: 0
Reputation: 448
There is multiple type of solution you can do it
delete the existing file from azure.
change the azure configuration settings
MSDEPLOY_RENAME_LOCKED_FILES = 1
if you dont want to delete the file then you can stop the service For example (Webjobs).
WEBJOBS_STOPPED = 1
Upvotes: 0
Reputation: 1706
Check out How to take web app offline while publishing for a possible solution. Basically including
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
in your pubxml file should alleviate the problem. However note that this might not work properly in all cases, especially for ASP.NET Core as evidenced by this thread on GitHub.
Upvotes: 1
Reputation: 2456
The only solution that worked for me: delete the site and then redeploy (with the same name). FTP creds continued to work.
Other things I tried that didn't work:
Upvotes: 0
Reputation: 678
We had a similar situation once. It was resolved using following steps.
Stop the site from the portal
FTP into site using client such as FileZilla. You can get the FTP url & credentials from publish profile by looking for publishMethod="FTP" section.
Navigate to site/wwwroot folder
Delete the locked file(s)
Start the website
Redeploy the site immediately from deployments tab in portal.
Upvotes: 2
Reputation: 30903
You should learn a bit about IIS and Web Deploy first.
Take a look at this SO Question is it basically describes the problem you have. In general it is a bit strange to have the assembly in use. Don't know the exact reason for this, but it lays somewhere in your assembly and, more importantly how it is being used.
As a suggestion - recycle the site before deploying (stop and start). Or try to deploy when the site is Stopped (which I doubt will be possible).
Upvotes: 1