我对 Microsoft ReportViewer 有疑问。每个新生成的报告都会添加一个新的 cookie,如下所示: 直到服务器由于请求中的 cookie 太多而/Reserved.ReportViewerWebControl.axd%3FOpType%3DSessionKeepAlive%26ControlID%3Df6166329be5f4b00aa32320285ffaf55_SKA
开始出错并出现错误。Bad Request - Request too long
我尝试手动使这些 cookie 过期,但没有成功。我的报表查看器的初始化代码:
var credentials = new ReportViewerCredentials { NetworkCredentials = System.Net.CredentialCache.DefaultCredentials};
mainReportViewer.ServerReport.ReportServerCredentials = credentials;
mainReportViewer.ProcessingMode = ProcessingMode.Remote;
mainReportViewer.ReportError += OnReportError;
mainReportViewer.ShowRefreshButton = false;
mainReportViewer.ShowWaitControlCancelLink = false;
mainReportViewer.ShowBackButton = false;
mainReportViewer.ShowCredentialPrompts = false;
mainReportViewer.AsyncRendering = true;
mainReportViewer.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerUrl"]);
ExtractReportParametersFromCookie(mainReportViewer);
mainReportViewer.ServerReport.Refresh();
网络配置:
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
</httpHandlers>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
<add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</buildProviders>
</compilation>
</system.web>
<system.webServer>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</handlers>
</system.webServer>
也许有人有想法如何解决这个问题?