MOSS2007自定义aspx页面中使用ReportViewer控件

来源:互联网 发布:ren域名 编辑:程序博客网 时间:2024/04/25 17:53


在assemblies新增

      <buildProviders>        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />      </buildProviders>


修改或新增httpHandlers

<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />


新增 safecontrol

<SafeControl Assembly="Microsoft.ReportViewer.WebForms,Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TypeName="*" Safe="True" />


遇见错误:

The type 'Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' does not implement IReportViewerMessages

在webconfig 中 appsettings 下加入:

<remove key="ReportViewerMessages" />


 

参考:

http://blogs.msdn.com/b/solutions/archive/2007/10/29/installing-sql-reporting-services-and-moss-2007-on-the-same-port-default-80.aspx

http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/228a697f-f391-4b04-8d30-aaca0e91130b/

 

遇见错误:

In remote mode, the Report Viewer control requires session state be enabled or Report Server connection information specified in the config file.

fix:

In your app's web.config make sure that the <pages> tag has the following properties:

<pages enableSessionState="true" enableViewState="true">


and in your <httpModules> section make sure you have the following entry:

<add name="Session"  type="System.Web.SessionState.SessionStateModule"/>


and after the <httpModules> section, include: <sessionState mode="InProc" cookieless="false" timeout="20"/>

 

或者

 

Try using the following

<appSettings><add key="ReportViewerServerConnection" value="Microsoft.ReportingServices.UI.WebControlConnection, ReportingServicesWebUserInterface, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /><add key="ReportViewerTemporaryStorage" value="Microsoft.ReportingServices.UI.ReportViewerTemporaryStorage, ReportingServicesWebUserInterface, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /><add key="ReportServerUrl" value="your report server url" /></appSettings>


 

 

参考:

http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/024abdfb-967e-478b-acfe-739f7b7e693a/

http://forums.asp.net/t/1308086.aspx/1

 

遇到错误

That assembly does not allow partially trusted callers

Fix:

修改Web.config

<trust level="Full" originUrl="" />


参考:

http://social.msdn.microsoft.com/Forums/zh-SG/sharepointdevelopment/thread/1e47c5c8-4608-4da0-81d2-ce3d82272420

 

遇到错误

  • The request failed with HTTP status 401: Unauthorized.

Fix:

新建类

    [Serializable]    public partial class ReportViewerCredentials : IReportServerCredentials    {        private string _userName;        private string _password;        private string _domain;        public ReportViewerCredentials(string userName, string password, string domain)        {            _userName = userName;            _password = password;            _domain = domain;        }        public ReportViewerCredentials()        {            //_userName = userName;            //_password = password;            //_domain = domain;        }        public WindowsIdentity ImpersonationUser        {            get            {                //return null;                return WindowsIdentity.GetCurrent();            }        }        public ICredentials NetworkCredentials        {            get            {                return new NetworkCredential(_userName, _password, _domain);                //return System.Net.CredentialCache.DefaultCredentials;            }        }        public bool GetFormsCredentials(out Cookie authCookie,                out string userName, out string password,                out string authority)        {            authCookie = null;            userName = _userName;            password = _password;            authority = _domain;            // Not using form credentials               return false;        }    }      


 

设定 reportviewer 的credentials

this.ReportViewer1.ServerReport.ReportServerCredentials = new ReportViewerCredentials("name", "password", "domain");


 

原创粉丝点击