3

所以我们有一个与此类似的自定义部署脚本

    msdeploy.exe ^
      -source:manifest='path_to_manifest' ^
      -dest:auto,ComputerName="https://host:port/msdeploy.axd?site=sitename",UserName='domain\user',Password='muhpass',IncludeAcls='False',AuthType='Basic' ^
      -verb:sync ^
      -enableRule:DoNotDeleteRule ^
      -disableLink:AppPoolExtension ^
      -disableLink:ContentExtension ^
      -disableLink:CertificateExtension ^
      -setParamFile:"path_to_the_file" ^
      -allowUntrusted ^
      -useChecksum ^
      -retryAttempts=2 ^
      -preSync:runCommand="path_to_script",waitInterval=60000 ^
      -postSync:runCommand="path_to_script",waitInterval=60000

我已经删除了一些值,但您可能会认为它们是正确的,因为脚本会成功部署应用程序,但并非每次都如此。这是失败的步骤:

    Performing '-preSync'...
    Info: Using ID '7bb88177-4329-4b66-a7b9-a563811edca3' for connections to the remote server.
    Error: (7/17/2013 2:27:00 PM) An error occurred when the request was processed on the remote computer.
    Error: An error occurred while communicating with the remote host. The error code is 0x80070006.
    Error: The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
    Error count: 1.
    Error during '-preSync'.

它通常会在几秒钟内完成,但每隔一段时间就会花费很长时间,最终我会收到上面的错误。此时我必须重新启动生产服务器上的 Web 管理服务,这通常会修复它直到下一次部署。但是,重新启动服务也会失败,但完成后,您至少可以手动启动服务,仅此而已。

如果我转到生产服务器上的事件查看器,它在 Microsoft Web Deploy 下会出现以下错误(错误的时间以及请求的 id 匹配):

    User: 
    Client IP: muh_ip
    Content-Type: application/msdeploy
    Version: 9.0.0.0
    MSDeploy.VersionMin: 7.1.600.0
    MSDeploy.VersionMax: 9.0.1631.0
    MSDeploy.Method: Sync
    MSDeploy.RequestId: 7bb88177-4329-4b66-a7b9-a563811edca3
    MSDeploy.RequestCulture: en-US
    MSDeploy.RequestUICulture: en-US
    ServerVersion: 9.0.1631.0
    Skip: objectName="^configProtectedData$"
    Provider: auto, Path: 
    A tracing deployment agent exception occurred that was propagated to the client. Request ID '7bb88177-4329-4b66-a7b9-a563811edca3'. Request Timestamp: '7/17/2013 11:27:00 AM'. Error Details:
    System.Web.HttpException: An error occurred while communicating with the remote host. The error code is 0x80070006. ---> System.Runtime.InteropServices.COMException (0x80070006): The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
       --- End of inner exception stack trace ---
       at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
       at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
       at System.Web.HttpResponse.Flush(Boolean finalFlush)
       at System.IO.BufferedStream.FlushWrite()
       at System.IO.BufferedStream.Flush()
       at System.IO.BufferedStream.Dispose(Boolean disposing)
       at System.IO.Stream.Close()
       at System.IO.StreamWriter.Dispose(Boolean disposing)
       at System.IO.StreamWriter.Close()
       at System.Xml.XmlTextWriter.Close()
       at Microsoft.Web.Deployment.TraceEventStreamSerializer.Dispose(Stream stream)
       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)

在我看来,这项服务肯定存在一些问题,但我没有想法,所以我将不胜感激任何可能有助于解决这个问题或至少收集更多信息的建议。这件事快把我逼疯了。最近它也变得越来越频繁 - 过去每周不到一次,现在每次我部署时都会发生。我意识到这篇文章真的很长,但我想包括所有相关信息。

服务器是带有 IIS 7.5 的 windows server 2008 R2 Enterprise v6.1 sp1。

tl;dr部署脚本随机失败,重新启动 Web 管理服务可以临时修复它,是吗?

4

0 回答 0