使用 msdeploy 部署时正在使用 dll grpc_csharp_ext.x64.dll

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

我在 gitlab 上使用 msdeploy 和这个参数:

[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"""
        )

我总是报错:

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

我怎样才能忽略这个错误或强制部署?? 此致

grpc_csharp_ext.x64.dll 被 IIS 锁定,所以这里是您的选项:

  1. 部署前在远程服务器上重新启动 IIS(您可以创建一个脚本来自动执行此过程,Jenkins 也可以在这里提供帮助)
  2. 如果您在本地遇到此问题,在 Visual Studio 中构建项目时 - 最简单的选择是添加 iisreset /stop 在构建前 事件,以及 iisreset /start 在 post-build 事件中,请参阅此处:Visual Studio 2013.2 can't build because IIS is locking an assembly)
  3. 将 grpc 降级到 2.25.0 版本(或更低版本),因为此问题与 2.26.0 及更高版本相关
  4. 将 grpc 升级到 2.30.0 版本,因为此版本在 Grpc.Core.targets 文件中实现了 SkipGrpcNativeLibsCopying 以解决此问题。在此处查看更多详细信息: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