使用 webdeploy 部署时出现 InvalidDataException
我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论