带有MSdeploy.exe的WebDeploy无法同步GAC程序集,因为dll已被另一个进程锁定

时间:2010-09-24 08:26:44

标签: gac msdeploy webdeploy iisreset

我使用msdeploy将GAC程序集同步到许多应用程序服务器时遇到此问题。

当我运行此命令时

msdeploy -verb:sync -source:gacAssembly="'MyAssembly'" -dest:gacAssembly,computername=DESTINATIONSERVER

我收到此错误:

* Microsoft.Web.Deployment.DeploymentException: (28/09/2010 16.46.37)在远程计算机上处​​理请求时发生错误。 ---> Microsoft.Web.Deployment.DeploymentClientServerException:处理'INPS.DNA.dll'时遇到错误。 ---> Microsoft.Web.Deployment.DeploymentException:错误代码为0x80070020。 ---> System.IO.IOException:进程无法访问“C:\ Windows \ assembly \ GAC_MSIL \ MYASSEMBLY \ 1.0.0.0__a31fe99d2f98435c \ MYASSEMBLY.dll”,因为它正由另一个进程使用。    在Microsoft.Web.Deployment.Win32Native.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode,String maybeFullPath)    在Microsoft.Web.Deployment.FileStreamEx.CreateInstance(String path,FileMode fileMode,FileAccess fileAccess)    在Microsoft.Web.Deployment.FilePathProvider.Add(DeploymentObject source,Boolean whatIf)    ---内部异常堆栈跟踪结束---    ---内部异常堆栈跟踪结束---    在Microsoft.Web.Deployment.DeploymentObject.Update(DeploymentObject源,DeploymentSyncContext syncContext)    在Microsoft.Web.Deployment.DeploymentSyncContext.HandleUpdate(DeploymentObject destObject,DeploymentObject sourceObject)    在Microsoft.Web.Deployment.DeploymentSyncContext.SyncDirPathChildren(DeploymentObject destRoot,DeploymentObject sourceRoot)    在Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest,DeploymentObject source)    在Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest,DeploymentObject source)    在Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject,DeploymentObject sourceObject)
   在Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject,DeploymentSyncOptions syncOptions,PayloadTable payloadTable,Conten tRootTable contentRootTable)    在Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentWorkerR equest workerRequest)    ---内部异常堆栈跟踪结束---    在Microsoft.Web.Deployment.StatusThreadHandler.CheckForException()    在Microsoft.Web.Deployment.AgentClientProvider.RemoteDestSync(DeploymentObje ct sourceObject,DeploymentSyncContext syncContext)    在Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject,DeploymentSyncOptions syncOptions,PayloadTable payloadTable,Conten tRootTable contentRootTable)    在Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions  providerOptions,DeploymentBaseOptions baseOptions,DeploymentSyncOptions syncO ptions)    在MSDeploy.MSDeploy.ExecuteWorker() 错误计数:1。*

如果我在DESTINATIONSERVER上执行 IISRESET ,则不会发生错误!

我的问题是:

可以在不执行IISRESET命令的情况下解锁DLL吗?

我想我可以避免重启整个Web服务器。

你能帮助我吗?

非常感谢!

最好的问候。

1 个答案:

答案 0 :(得分:2)

使用recyleApp提供程序停止和启动应用程序池怎么样?

msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="Default Web Site",recycleMode="StopAppPool",computerName=remote-computer

......做你真正的部署......

msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="Default Web Site",recycleMode="StartAppPool",computerName=remote-computer