使用 webdeploy 部署时出现 InvalidDataException

发布于 2024-10-10 09:58:57 字数 2962 浏览 4 评论 0原文

我使用 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);

I created a package using Visual Studio.

I then copy it to a server and deploy that package locally (i have a C# program that does this, code is below)

I make changes and build V2 of the package, when I deploy it I get an InvalidDataException (full stack below):

Other details:

  • OS Server2008 R2

  • Only happens when the package is put into an installer, if i just build locally and run it it works every time.

  • The zip files put down by the installer work fine the first time, so I can work around this problem by deleting the deployed files and then rerunning

  • I am using WebDeploy v2 (but also had this problem with v1)

Error Stack:

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)

What my program is doing (extracted and condensed):

 _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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文