0

在我的错误日志中,我看到以下错误和堆栈跟踪:

页面错误:URL: /SiteCollectionImages/Push/zh-cn/Machining_calculators.jpg
启用调试:错误
相关 ID: 857a397e-8063-447c-af92-b114074282b8
消息:发送 HTTP 标头后服务器无法附加标头。
来源: System.Web
StackTrace:在
Microsoft.SharePoint.Publishing.BlobCache.SetResponseHeaders(HttpContext context, BlobCacheEntry target)
在 Microsoft.SharePoint.Publishing.BlobCache.SendCachedFile( HttpContext 上下文、BlobCacheEntry 目标、SPUserToken currentUserToken、SiteEntry currentSiteEntry)
在 Microsoft.SharePoint.Publishing.BlobCache.HandleCachedFile(HttpContext 上下文
,BlobCacheEntry 目标,布尔匿名用户,SiteEntry currentSiteEntry)在 Microsoft.SharePoint.Publishing 的 Microsoft.SharePoint.Publishing.BlobCache.SendCachedFile(HttpContext 上下文,BlobCacheEntry 目标,SiteEntry currentSiteEntry)。 BlobCache.RewriteUrl(Object sender, EventArgs e, Boolean preAuthenticate) at Microsoft.SharePoint.Publishing.PublishingHttpModule.AuthorizeRequestHandler(Object sender, EventArgs ea)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
在 System.Web.HttpApplication.ExecuteStep(IExecutionStep 步骤,Boolean& completedSynchronously)

似乎内置的 BlobCache 在将响应发送到服务器后尝试设置 httpresponse-headers。有谁知道如何纠正这个问题,或者它是 SharePoint 平台中的一个错误?

更新:我的 web.config 看起来像这样:

<BlobCache location="d:\BlobCache\companyname" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv)$" maxSize="10" enabled="true" />

还值得一提的是,并非所有图像请求都会发生这种情况。大约 90-95% 的图像请求最终被正确地缓存在指定的位置,并使用正确的响应代码发送到客户端。

Update2:从 HttpModules 挂钩到 HttpApplication:

app.PreSendRequestContent += new EventHandler(app_PreSendRequestContent);

以及 HttpModule 中的一些 SharePoint 特定代码:

var spApp = context as SPHttpApplication;
if (spApp != null)
{
    var labelHandler = new VaryByLabelHandler();
    spApp.RegisterGetVaryByCustomStringHandler(labelHandler);
    var countryHandler = new VaryByCountryHandler();
    spApp.RegisterGetVaryByCustomStringHandler(countryHandler);
    var claimHandler = new VaryByClaimHandler();
    spApp.RegisterGetVaryByCustomStringHandler(claimHandler);
}
4

3 回答 3

2

该问题是由我认为 SharePoint 平台中的错误引起的。该问题影响了存储在 SiteCollection-library 中的图像,但并非所有图像。在深入挖掘之后,并获得了一些运气。我可以看到这些图像在我们关闭列表上的内容批准之前已经上传,这可以通过使用“管理内容和结构”工具看到。这些图像仍处于草稿模式。这不应该是这样,因为我们关闭了内容批准,但由于某种原因,此设置影响了 BlobCache 正确服务它们的能力。

使用 Fiddler 可以很容易地观察到哪些图像受到影响,并且看到这些图像提示来自服务器的 304 响应,而其他图像则直接从客户端缓存中获取。

解决方案是对这些图像进行批量签出和批量签入,然后他们获得批准状态“已批准”,问题就解决了。

于 2012-11-14T14:57:16.767 回答
0

您没有会绕过/覆盖本机 SharePoint 的客户 http 处理程序吗?看起来有些东西设法在 SharePoint 从磁盘检索响应或从数据库中获取响应并随后将其存储在磁盘上之前将其发回。

你能在网络配置上给我们你的 blobcache 条目吗?blob 存储的目标位置是否根据请求填充?您是否在该文件夹上设置了相关权限?

亲切地。

于 2012-05-15T19:56:48.547 回答
0

我的猜测是,这实际上不是由 blob 缓存引起的,而是由 http 模块之一引起的。例如,您是否在任何地方挂钩 HttpApplication.ReleaseRequestState?在这种情况下,需要将其更改为 HttpApplication.EndRequest。这是这个问题的一个很常见的原因......

于 2012-05-17T09:26:03.227 回答