Hi,I have .Net Core 5 API which internally using cognitive services (Speech to text). when i am trying to release it on azure webapp. i am getting below error(shown in image). though it is working in locally and local IIS as well.

Hi,I have .Net Core 5 API which internally using cognitive services (Speech to text). when i am trying to release it on azure webapp. i am getting below error(shown in image). though it is working in locally and local IIS as well.

@sanm-7576 Thanks for reaching out. This error occurs when a destination file cannot be overwritten or deleted because it is currently in use.
Please check if the following help:
Make sure that the destination file is not in use before performing a sync. Consider taking the application offline during the sync by enabling the appOffline rule. You can configure the appOffline rule in the publishing profile (.pubxml).
Add the EnableMSDeployAppOffline element to the PropertyGroup like this:<PropertyGroup> <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline></PropertyGroup>
Add MSDEPLOY_RENAME_LOCKED_FILES=1 in your webapp's application settings. When set, it enables web deploy to rename files that are locked during app deployment.
Check this blog post for other available approaches to fix the error.
Hope this helps. Do let us know if you have further questions.
If an answer is helpful, please "Accept answer" and/or "Up-Vote" which might help other community members reading this thread.
Thanks. I tried all these possible solution but unfortunately issue still persist. though it is working in IIS hosted
@sanm-7576 Do any of the other publishing methods like deploying to an Azure target or Zip deploy work?
Here is some additional guidance for troubleshooting locked files during deployment: Dealing with locked files during deployment
Thanks it was some application issue . When I commented IsDevelopment then i was able to see error and fix it.
17 people are following this question.
App Insights - retrieveing Question, Answer and Score
How to always use new docker named volume for every web app deployment?
Bing Image Search API Error 401: Permission Denied even with correct Key
TypeError: request() got an unexpected keyword argument 'show_opinion_mining'
can't able to connncet to mongodb when deploying web app for containers through docker-compose