microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.51k stars 2.62k forks source link

IIS Deploy on premises fails with ERROR_FILE_IN_USE #13232

Open mpoiron opened 4 years ago

mpoiron commented 4 years ago

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: IISWebAppDeploymentOnMachineGroup

Environment

Issue Description

I'm using the IISWebAppDeploymentOnMachineGroup@0 task to deploy a .NET Core 3.1 app to IIS on premises. The task fails sometimes with a ERROR_FILE_IN_USE code. I have set the TakeAppOfflineFlag to true but nothing changed.

Task logs

tasklogs.zip

Troubleshooting

Error logs

Info: Updating file (AGIL\Crpdl.Agil.Web.dll).
##[debug]Exit code 4294967295 received from tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[debug]Exit code 4294967295 received from tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[debug]STDIO streams have closed for tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[debug]STDIO streams have closed for tool 'C:\azagent\A1\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.156.13\node_modules\webdeployment-common-v2\MSDeploy3.6\msdeploy.exe'
##[error]Failed to deploy web package to IIS website.
##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to IIS website.
##[debug]{}
##[debug]System.DefaultWorkingDirectory=C:\azagent\A1\_work\1\s
##[warning]Can\'t find loc string for key: Trytodeploywebappagainwithrenamefileoptionselected
##[debug]Processed: ##vso[task.issue type=warning;]Can\'t find loc string for key: Trytodeploywebappagainwithrenamefileoptionselected
##[warning]Trytodeploywebappagainwithrenamefileoptionselected
##[debug]Processed: ##vso[task.issue type=warning;]Trytodeploywebappagainwithrenamefileoptionselected
##[error]Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'Crpdl.Agil.Web.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.
captnord commented 10 months ago

we have Azure Devops server 2022.1 and after updating our .net version to 8 we have also this problems with every 2 release : Failed to deploy web package to IIS website. Error Code: ERROR_FILE_IN_USE Additional Information: Web Deploy cannot modify the Localization.resources.dll file in the target because it is locked by an external process. For the publishing process to complete successfully, you may need to restart your application to release the lock or use the AppOffline rule handler for .NET applications on your next publishing attempt.

@Maryam1986 We are also experiencing the issue with a .NET 8 Blazor Web App deployed on premise with IIS Web Deploy in DevOps. I'm hoping that the fix for this ASP.NET Core team issue (https://github.com/dotnet/aspnetcore/issues/52307) will resolve the issue we are having with the file lock, presumably caused by the app_offline.html file not being honored.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

VictorioBerra commented 3 months ago

Bump.

On Thu, Aug 8, 2024, 10:06 AM github-actions[bot] @.***> wrote:

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

— Reply to this email directly, view it on GitHub https://github.com/microsoft/azure-pipelines-tasks/issues/13232#issuecomment-2276060079, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWMN2YY4MNRR2H4XMC4FMTZQOCQ7AVCNFSM4OPY2W2KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRXGYYDMMBQG44Q . You are receiving this because you were mentioned.Message ID: @.***>

jacobhoward214 commented 3 weeks ago

I was able to find a solution that works for me when receiving this error. I received the error downloading a different dll for my .NET 5.0 web application. Inside of the Release Pipeline > Manage ISSWebsite task > Select Create or update app pool > Open the IIS Application Pool menu panel > Enter a Name > Set .NET Version to v4.0 > Set Managed pipeline mode to Integrated > Set Identity to Application Pool Identity.

Hope this helps, best of luck all.