2013-05-13 220 views
2

我有一個Microsoft ReportViewer的問題。 每個新生成的報告都添加了一個新的cookie,如下所示:/Reserved.ReportViewerWebControl.axd%3FOpType%3DSessionKeepAlive%26ControlID%3Df6166329be5f4b00aa32320285ffaf55_SKA 直到服務器開始因012請求中的Cookie太多而導致Bad Request - Request too long錯誤。 我試過手動過期這些cookies,但沒有成功。 我的報表查看器初始化代碼:Reserved.ReportViewerWebControl.axd 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(); 

的Web.Config:

<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> 

也許有人想法如何解決這個問題?

回答

2

似乎KeepSessionAlive="False"解決了這個問題,可以用作解決方法。

+0

請您詳細說明一下嗎?在Web.config的哪一部分或者rsreportserver.config應該添加? – komsky 2016-06-02 07:53:54

+0

它可以在代碼中完成,如[reportViewer.KeepSessionAlive = false] – mido 2017-06-05 13:44:45