Search code examples
gitlab-cicontinuous-deploymentgrpcmsdeploy

dll grpc_csharp_ext.x64.dll in use when deploying with msdeploy


I'm using msdeploy on gitlab with this args:

[string[]]$msdeployArgs = @(
            "-source:package='$packageFile',IncludeAcls='False'",
            "-dest:auto,ComputerName='https://$($server):8172/MsDeploy.axd?site=$($iisWebsite)',UserName='$($deployUsr)',Password='$($deployUsrPwd)',IncludeAcls='False',AuthType='Basic'",
            "-verb=sync",
            "-disableLink:AppPoolExtension",
            "-disableLink:ContentExtension",
            "-disableLink:CertificateExtension",
            "-allowUntrusted",
            "-retryAttempts=2",
            "-enableRule:AppOffline",
            "-setParam:name=""IIS Web Application Name"",value=""$iisApplicationName"""
        )

and I have always an error:

Info: Using ID '41f89bfc-34bd-41c2-a820-ad75f7966651' for connections to the remote server.
Info: Adding ACLs for path (test)
Info: Adding ACLs for path (test)
Info: Adding ACLs for path (test/App_Data)
Info: Using ID '33b1c88c-c667-44b0-9b2e-ffeedf0a3e0f' for connections to the remote server.
Info: Updating file (tes\App_Data\Anonymous.xml).
Info: Updating file (test\Areas\Web.config).
Info: Updating file (test\bin\grpc_csharp_ext.x64.dll).
Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'grpc_csharp_ext.x64.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.
msdeploy errorCode: -1

how can i please ignore this error or force to deploy ?? Regards


Solution

  • grpc_csharp_ext.x64.dll is locked by IIS, so here are your options:

    1. Restart IIS on the remote server before deploying (you can create a script to automate this process, Jenkins can also come to aid here)
    2. If you have this issue locally, when building your project in Visual Studio - the easiest option would be to add iisreset /stop at pre-build event, and iisreset /start at the post-build event, see here: Visual Studio 2013.2 can't build because IIS is locking an assembly)
    3. Downgrade grpc to version 2.25.0 (or below), as this issue related to version 2.26.0 and up
    4. Upgrade grpc to version 2.30.0, as this version implemented SkipGrpcNativeLibsCopying in Grpc.Core.targets file to resolve this issue. see more detail here: https://github.com/grpc/grpc/issues/21867 and here https://github.com/grpc/grpc/pull/22894, but be aware of the warning mentioned here: https://github.com/grpc/grpc/pull/22894/commits/c6723399b8d7ed580e72220b7d880f57d1d5eae9