使用webdeploy进行部署时出现InvalidDataException

时间:2011-01-06 21:49:52

标签: msdeploy webdeploy

我使用Visual Studio创建了一个包。

然后我将它复制到服务器并在本地部署该软件包(我有一个C#程序执行此操作,代码如下)

我进行更改并构建包的V2,当我部署它时,我得到一个InvalidDataException(下面的完整堆栈):

其他细节:

  • OS Server2008 R2

  • 只有在将软件包放入安装程序时才会发生,如果我只是在本地构建并运行它,那么它每次都有效。

  • 安装程序放下的zip文件第一次运行正常,因此我可以通过删除已部署的文件然后重新运行来解决此问题

  • 我正在使用WebDeploy v2(但v1也存在这个问题)

错误堆栈:

Error: System.IO.InvalidDataException: Found invalid data while decoding.
 at System.IO.Compression.Inflater.DecodeDynamicBlockHeader()
 at System.IO.Compression.Inflater.Decode()
 at System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length)
 at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)
 at Microsoft.Web.Deployment.SerializationHelper.CopyStream(Stream sourceStream, Stream destStream, Byte[] buffer)
 at Microsoft.Web.Deployment.FilePathProvider.Add(DeploymentObject source, Boolean whatIf)
 at Microsoft.Web.Deployment.DeploymentObject.Update(DeploymentObject source, DeploymentSyncContext syncContext)
 at Microsoft.Web.Deployment.DeploymentSyncContext.HandleUpdate(DeploymentObject destObject, DeploymentObject sourceObject)
 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)
 at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)

我的程序正在做什么(提取和浓缩):

 _syncOptions = new DeploymentSyncOptions() {DeleteDestination = false,DoNotDelete = false};
 _sourceBaseOptions = new DeploymentBaseOptions();
 _destBaseOptions = new DeploymentBaseOptions
 {
 TraceLevel = TraceLevel.Verbose,
 };
 var appDeploymentObject = DeploymentManager.CreateObject(DeploymentWellKnownProvider.Package,
 applicationPackage,
 _sourceBaseOptions);
 DeploymentRule rule = null;
 if (_syncOptions.Rules.TryGetValue("IISConfigFrom64To32", out rule))
 {
 _syncOptions.Rules.Remove("IISConfigFrom64To32");
 }
 var summary = DeploymentObject.SyncTo(destBaseOptions, _syncOptions);

0 个答案:

没有答案