在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" />
参考:
遇见错误:
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="" />
参考:
遇到错误
- 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");