msdeploy 时不时会失败,提示无法删除目录

msdeploy 时不时会失败,提示无法删除目录

我们有一个启用了 MsDeploy 的交付功能,通常它可以在多台服务器上完美运行。但是在 3 台 Windows 2012 R2 服务器上,它有时会失败,提示无法删除目录。事件日志中记录了以下错误:

User: 
Client IP: masked

Content-Type: application/msdeploy
Version: 9.0.0.0
MSDeploy.VersionMin: 7.1.600.0
MSDeploy.VersionMax: 9.0.1764.0
MSDeploy.Method: Sync
MSDeploy.RequestId: 41e11d1d-ab5d-457e-9daf-7bff7655d6ac
MSDeploy.RequestCulture: en-US
MSDeploy.RequestUICulture: en-US
ServerVersion: 9.0.1763.0
Skip: objectName="^configProtectedData$"objectname="filePath",absolutepath="app_offline-template.htm"objectname="filePath",absolutepath="app_offline.htm"
Provider: auto, Path: 
A tracing deployment agent exception occurred that was propagated to the client. Request ID '41e11d1d-ab5d-457e-9daf-7bff7655d6ac'. Request Timestamp: '10/20/2015 9:21:42 AM'. Error Details:
Microsoft.Web.Deployment.DeploymentClientServerException: An error was encountered when processing operation 'Delete Directory' on 'some_path'. ---> Microsoft.Web.Deployment.DeploymentException: The error code was 0x80070091. ---> System.IO.IOException: The directory is not empty.

   at Microsoft.Web.Deployment.NativeMethods.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath)
   at Microsoft.Web.Deployment.DirectoryEx.Delete(String path)
   at Microsoft.Web.Deployment.DirPathProviderBase.Delete(Boolean whatIf)
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at Microsoft.Web.Deployment.FilePathProviderBase.HandleKnownRetryableExceptions(DeploymentBaseContext baseContext, Int32[] errorsToIgnore, Exception e, String path, String operation)
   at Microsoft.Web.Deployment.DirPathProviderBase.Delete(Boolean whatIf)
   at Microsoft.Web.Deployment.DeploymentObject.DeleteOperation(DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentObject.Delete(DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleDelete(DeploymentObject destObject, DeploymentObject sourceParentObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncDirPathChildren(DeploymentObject destRoot, DeploymentObject sourceRoot)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncDirPathChildren(DeploymentObject destRoot, DeploymentObject sourceRoot)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleRequestWorker(DeploymentAgentAsyncData asyncData)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleRequest(DeploymentAgentAsyncData asyncData)

所有部署都从将 app_offline.htm 放入 Web 应用程序的根目录开始,并将其作为单独的步骤删除 - 因此,应用程序将无法启动。路径每次都不同。如果立即重新启动部署 - 它将失败(尽管应用程序由于 App_offline.htm 而处于离线状态)实现成功部署的唯一方法(迄今为止发现) - 通过 IIS 重新启动管理服务。

有时在开始部署之前重新启动管理服务会有所帮助。

答案1

我通过将 SkipExtraFilesOnServer 设置为 True 来修复它 - 因此,我没有清理服务器上的文件系统,但构建运行正常

相关内容