在我的错误日志中,我看到以下错误和堆栈跟踪:
页面错误: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);
}