Azure App Service Deploy fails for .net core 2.0 with ERROR_FILE_IN_USE
See original GitHub issueI am trying to deploy an Asp.Net Core 2.0 web app to Azure App Service and receive this error
2017-09-07T15:20:07.7379097Z ##[section]Starting: Deploy Azure App Service
2017-09-07T15:20:07.7569101Z ==============================================================================
2017-09-07T15:20:07.7569101Z Task : Azure App Service Deploy
2017-09-07T15:20:07.7569101Z Description : Update Azure Web App Services, Web App On Linux , Function Apps, Mobile Apps using Web Deploy / Kudu REST APIs
2017-09-07T15:20:07.7569101Z Version : 3.3.14
2017-09-07T15:20:07.7569101Z Author : Microsoft Corporation
2017-09-07T15:20:07.7569101Z Help : [More Information](https://aka.ms/azurermwebdeployreadme)
2017-09-07T15:20:07.7569101Z ==============================================================================
2017-09-07T15:20:11.9902809Z Got connection details for Azure App Service:'ββββββββββββββ'
2017-09-07T15:20:16.5780995Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='d:\a\r1\a\ββββββββββββββ\drop\ββββββββββββββ.zip' -dest:auto,ComputerName='https://ββββββββββββββ.scm.azurewebsites.net:443/msdeploy.axd?site=ββββββββββββββ',UserName='********',Password='********',AuthType='Basic' -setParam:name='IIS Web Application Name',value='ββββββββββββββ' -enableRule:AppOffline -retryInterval:6000 -retryAttempts:10 -enableRule:DoNotDeleteRule -userAgent:VSTS_e29e8f6a-6b5e-463d-ba6e-72dd7866010e_release_10_50_99_1
2017-09-07T15:20:17.1910281Z Info: Using ID 'ββββββββββββββββββββββββββββββββββββ' for connections to the remote server.
2017-09-07T15:20:21.1058805Z Info: Using ID 'ββββββββββββββββββββββββββββββββββββ' for connections to the remote server.
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\appsettings.Development.json).
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\appsettings.json).
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\Connected Services\Application Insights\ConnectedService.json).
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\ββββββββββββββ.Contract.dll).
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\ββββββββββββββ.Contract.pdb).
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\ββββββββββββββ.deps.json).
2017-09-07T15:20:27.0283815Z Info: Updating file (ββββββββββββββ\ββββββββββββββ.dll).
2017-09-07T15:21:24.7852633Z ##[error]Failed to deploy web package to App Service.
2017-09-07T15:21:24.7862628Z ##[warning]Try to deploy app service again with Rename locked files option selected.
2017-09-07T15:21:24.7862628Z ##[error]Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'ββββββββββββββ.dll' 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.
Error count: 1.
2017-09-07T15:21:24.7862628Z ##[error]Error: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe failed with return code: 4294967295
2017-09-07T15:21:26.2210992Z Successfully updated deployment History at https://ββββββββββββββ.scm.azurewebsites.net/deployments/501504797684782
2017-09-07T15:21:26.2321177Z ##[section]Finishing: Deploy Azure App Service
Iβve tried some workarounds from similar issue without any luck https://github.com/Microsoft/vsts-tasks/issues/1607
Any ideas on what should I do to fix this?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:23
- Comments:129 (29 by maintainers)
Top Results From Across the Web
Getting ERROR_FILE_IN_USE while using Web Deploy in ...
There is an issue tracked here : Azure App Service Deploy fails for .net core 2.0 with ERROR_FILE_IN_USE and based on vincentdass's commentΒ ......
Read more >Common error troubleshooting for Azure App Service and IIS ...
Provides troubleshooting advice for the most common errors when hosting ASP.NET Core apps on Azure Apps Service and IIS.
Read more >Azure App Service deploy v4 task - Microsoft Learn
Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby.
Read more >Troubleshoot ASP.NET Core on Azure App Service and IIS
Learn how to diagnose problems with Azure App Service and Internet Information Services (IIS) deployments of ASP.NET Core apps.
Read more >Deploy ASP.NET Core apps to Azure App Service
If a problem occurs using the preview site extension, open an dotnet/AspNetCore issue. From the Azure Portal, navigate to the App Service.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is definitely a hack/workaround, not a very satisfying solution.
New Version of Web Deploy is used in App Service Deploy to avoid FILE_IN_USE as per web deploy team recommendation. If you still face
FILE_IN_USE
error, we recommend you to move fromWeb Deploy
toRun From Package
.Run From Package
support is added in4.*
task version of Azure App Service Deploy task.Run From Package helps in avoiding the FILE_IN_USE error.
If you face the below issue,
Publish using zip deploy option is not supported for msBuild package type.
, please follow the steps provided here to change the package format.#8710 - Added recommended message in the error logs to move from Web Deploy to Run From Package.
Closing the issue as the above recommendations should fix this. Please feel free to re-open or start a new thread, if any assistance required.