SharePoint发布使用SetResponseHeaders的BlobCache错误

时间:2012-05-11 12:47:05

标签: sharepoint sharepoint-2010

在我的错误日志中,我看到以下错误和stacktrace:

页面错误:网址: /SiteCollectionImages/Push/zh-cn/Machining_calculators.jpg
启用调试:错误相关性ID: 857a397e-8063-447c-af92-b114074282b8
消息: 发送HTTP标头后,服务器无法附加标头。
:System.Web
StackTrace :at System.Web.HttpResponse.AppendHeader(String name,String value)
在Microsoft.SharePoint.Publishing.BlobCache.SetResponseHeaders(HttpContext上下文,BlobCacheEntry目标)
   在Microsoft.SharePoint.Publishing.BlobCache.SendCachedFile(HttpContext上下文,BlobCacheEntry目标,    SPUserToken currentUserToken,SiteEntry currentSiteEntry)
   在Microsoft.SharePoint.Publishing.BlobCache.SendCachedFile(HttpContext上下文,BlobCacheEntry目标,SiteEntry currentSiteEntry)
   在Microsoft.SharePoint.Publishing.BlobCache.HandleCachedFile(HttpContext context,BlobCacheEntry target,Boolean anonymousUser,SiteEntry currentSiteEntry)    在Microsoft.SharePoint.Publishing.BlobCache.RewriteUrl(Object sender,EventArgs e,Boolean preAuthenticate)    在Microsoft.SharePoint.Publishing.PublishingHttpModule.AuthorizeRequestHandler(Object sender,EventArgs ea)
   在System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   在System.Web.HttpApplication.ExecuteStep(IExecutionStep step,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);
}

3 个答案:

答案 0 :(得分:2)

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

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

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

答案 1 :(得分:0)

您是否拥有可绕过/覆盖原生SharePoint的客户http处理程序?在SharePoint从磁盘检索响应或从数据库中获取响应并将其随后存储在磁盘上之前,似乎可以设法回送响应。

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

答案 2 :(得分:0)

我的猜测是,这实际上并不是由blob缓存引起的,而是由其中一个http模块引起的。你举个HttpApplication.ReleaseRequestState的例子吗?在这种情况下需要更改为HttpApplication.EndRequest。这是解决这个问题的常见原因......