Azure Web App deploy: Web Deploy cannot modify the file on the destination because it is locked by an external process

前端 未结 11 796
甜味超标
甜味超标 2020-12-14 07:24

I am using the \"Azure Web App Deployment\" build step in VSTS to publish an ASP.NET Core API to an Azure Web App:

Occasionally, this step breaks with the f

相关标签:
11条回答
  • 2020-12-14 08:01

    I was getting the same error while I was trying to publish my Azure Function App. I followed this Microsoft document and did the following steps.

    1. Right click on your Project and select Edit ....csproj
    2. Add <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline> in PropertyGroup tag

      <PropertyGroup>
        <TargetFramework>netcoreapp2.1</TargetFramework>
        <AzureFunctionsVersion>v2</AzureFunctionsVersion>
        <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
      </PropertyGroup>
      
    3. Save and Rebuild your solution

    4. Now publish again

    If that didn't work for you, you can always add MSDEPLOY_RENAME_LOCKED_FILES=1 as Mr. Ben mentioned in his answer, to your Application settings. You can do that from Visual Studio itself.

    Hope it helps

    0 讨论(0)
  • 2020-12-14 08:01

    Taking website offline while release should do the trick.

    0 讨论(0)
  • 2020-12-14 08:05

    I was struggling with the same locking issue.
    There are now a new Tasks (in Preview) that you can add for starting and stopping the App Service:

    Add a stop task before deployment and a start task after the deployment.

    This did the trick for me.

    0 讨论(0)
  • 2020-12-14 08:05

    There are some dedicated tasks for asp.net core projects because the deployment process is a little bit different.
    You can get those from the marketplace for free, check out DNX Tasks vsts marketplace
    Hope that helps!!

    0 讨论(0)
  • 2020-12-14 08:17

    Juste add

    <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
    

    to your publish profile(.pubxml).

    0 讨论(0)
  • 2020-12-14 08:20

    As per a separate thread in the Microsoft Github repo here, there's a hacky workaround where if you add the following key to the Azure Appsettings, it can help resolve the locked file deployment error:

    MSDEPLOY_RENAME_LOCKED_FILES = 1
    

    I'm not sure how long this appsetting hack will be supported, but it did help solve the issue for me personally.

    0 讨论(0)
提交回复
热议问题