在 Sitefinity API 中为文件系统上已存在的文档创建文件 [英] Creating Files in Sitefinity API for docs that already exist on Filesystem

查看:28
本文介绍了在 Sitefinity API 中为文件系统上已存在的文档创建文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Sitefinity 作为 Visual Studio 2012 中的解决方案.我在 64 位机器上.我刚刚安装了 Windows Identity Manager,因为在此之前我遇到了另一个错误,这与没有安装它有关.现在我收到此错误:

解码时发现无效数据.说明:在执行当前 Web 请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息.

异常详细信息:System.IO.InvalidDataException:解码时发现无效数据.

源错误:

在执行当前 Web 请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息.

堆栈跟踪:

[InvalidDataException:解码时发现无效数据.]System.IO.Compression.Inflater.DecodeDynamicBlockHeader() +6621162System.IO.Compression.Inflater.Decode() +408System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length) +150System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count) +64Microsoft.IdentityModel.Web.DeflateCookieTransform.Decode(Byte[] 编码) +396Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound) +217Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) +1958Telerik.Sitefinity.Security.Claims.SitefinitySessionTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) +44Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token, SecurityTokenResolver tokenResolver) +149Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.ReadToken(Byte[] sessionCookie) +520Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.TryReadFromCookie(SessionSecurityToken& sessionToken) +111Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +95System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

我也遵循了这篇文章前后的建议,但它对我不起作用:http://www.sitefinity.com/developer-network/knowledge-base/getting-type-is-not-resolved-for-member-microsoft-identitymodel-claims-claimsprincipal-exception >

这就是促使我安装 Microsoft 身份管理器的原因.我不知道如何解决这个问题.

解决方案

Microsoft 在 .Net 4.5 之前的 DeflateStream 实现中存在错误.

参见此处:

<块引用>

.NET [4 和以前的] 用户不应使用 Microsoft 提供的任何情况下的 GZipStream 或 DeflateStream 类,除非微软用有效的东西完全取代了它们.

这个对于 .NET 框架 4.5 之前的版本

,Microsoft 从未修复过此错误

至于 Firefox 和 IE 之间的区别——它们在使用 gzip 压缩时与 IIS 的交互方式可能不同,如果您查看原始 HTTP 请求和响应,Fiddler 可能会告诉您更多关于您情况的差异.检查浏览器之间的请求顺序是否相同.我的直觉是 Firefox 正在退回到无压缩状态,而 IE 则没有,但如果没有测试平台,我将无法提供更多帮助.

<小时>

您可以按绝望的顺序尝试这三种解决方案:

  1. 看看您是否可以在 IIS 中更改 SiteFinity 应用程序和 Visual Studio 中的 .NET 框架目标的应用程序池,以将其 GZIP DeflateStream 方法固定在 .NET 4.5 中.

  2. 尝试禁用 GZIP 压缩此应用程序的 IIS.按照此处相反的说明进行操作.我会最后尝试这个,因为您的服务器和所有用户都会损失带宽,影响用户体验.

  3. 安装 DotNetZip 库,并覆盖 Microsoft 的 System.IO 实施.Compression.DeflateStream 调用没有相同错误的兼容方法.

I am working with Sitefinity as a solution in Visual Studio 2012. I'm on a 64bit machine. I just installed Windows Identity Manager as I was getting another error before that and it was related to not having that installed. Now I am receiving this error:

Found invalid data while decoding. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.InvalidDataException: Found invalid data while decoding.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidDataException: Found invalid data while decoding.]
   System.IO.Compression.Inflater.DecodeDynamicBlockHeader() +6621162
   System.IO.Compression.Inflater.Decode() +408
   System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length) +150
   System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count) +64
   Microsoft.IdentityModel.Web.DeflateCookieTransform.Decode(Byte[] encoded) +396
   Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie,     Boolean outbound) +217
   Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReader reader,     SecurityTokenResolver tokenResolver) +1958
   Telerik.Sitefinity.Security.Claims.SitefinitySessionTokenHandler.ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) +44
   Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(Byte[] token, SecurityTokenResolver tokenResolver) +149
   Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.ReadToken(Byte[] sessionCookie) +520
   Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.TryReadFromCookie(SessionSecurityToken& sessionToken) +111
   Telerik.Sitefinity.Security.Claims.SitefinitySessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +95
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

I also followed the advice before and after this post and it did not work for me: http://www.sitefinity.com/developer-network/knowledge-base/getting-type-is-not-resolved-for-member-microsoft-identitymodel-claims-claimsprincipal-exception

which is what led me to installing the Microsoft identity Manager. I'm not sure how to get past this issue.

解决方案

There are bugs in Microsoft's DeflateStream implementation prior to .Net 4.5.

See here:

.NET [4 and previous] users should not use the Microsoft-provided GZipStream or DeflateStream classes under any circumstances, unless Microsoft replaces them completely with something that works.

This bug was never fixed by Microsoft for earlier versions of the .NET framework than 4.5

As for the difference between Firefox and IE - they might be interacting differently with IIS while using gzip compression, Fiddler might be able to tell you more about the differences in your situation if you look at the raw HTTP requests and responses. Check if the request sequence looks the same between browsers. My gut feeling is that Firefox is falling back to no compression and IE isn't, but without a test bed I won't be able to help further.


You could try these three solutions in increasing order of desperation:

  1. See if you can change the app pool in IIS for the SiteFinity application and your .NET framework target inside Visual Studio to target .NET 4.5 where their GZIP DeflateStream method was fixed.

  2. Attempt to disable GZIP compression in IIS for this application. Follow the instructions found here in reverse. I would try this last because there will be a bandwidth penalty for your server and all users, affecting the user experience.

  3. Install the DotNetZip Library, and override Microsoft's implementation of System.IO.Compression.DeflateStream to call a compatible method that doesn't have the same bug.

这篇关于在 Sitefinity API 中为文件系统上已存在的文档创建文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆