Failed to connect to report server. Setting URLs and paths in ASP.NET?

I am trying to connect to Report (rdlc file) using ASP.NET web applications. I work with VS2010, and Report Server - with the version of 2008.

I have the following report url that works fine:

 http://server url/Products/_layouts/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/Products/Dashboards/Product_tool.rdl&Source=Server Url/Products/Dashboards/Forms/AllItems.aspx&DefaultItemOpen=1 

When I enter this URL into my browser, it first asks for the user password. When I log in, then Report displayed just fine.

Now I need to display this report in the Report Viewer . So I added a Report Viewer element to my aspx page. I configured urls like this:

Report Server:** http://server url/Products/_layouts/ReportServer

Report Path:** /Products/Dashboards/Product_tool.rdl

I am not sure if this is even correct.

Anyway, in my PageLoad , I have the following line of code:

 eportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials("myuser", "mypass"); 

The ReposrtCredentials class ReposrtCredentials taken from: http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/c65abca7-0fdb-40fb-aabe-718f63377a55/ (from Phil)

Now, when I launch my web application, I get the following error:

An attempt to connect to the report server failed. Check yours and that the report server is a compatible version.

Now I'm not sure if the URL specified in the Report Viewer correctly specified? Or what else could be the problem.

Any idea ..?

+4
reporting-services reportviewer report-viewer2010
source share
2 answers

When you set up the report viewer, check if the account has permission to view the report because you need to have access when using the server report. Check out this link. They will help: http://forums.asp.net/t/1562624.aspx/1

+1
source share

To integrate SSRS reports into an ASP.NET application, follow these steps:

First, run the IReportServerConnection2 interface. I did something like this:

  public sealed class CustomReportServerConnection : IReportServerConnection2 { public WindowsIdentity ImpersonationUser { get { // Use the default Windows user. Credentials will be // provided by the NetworkCredentials property. return null; } } public ICredentials NetworkCredentials { get { // Read the user information from the web.config file. // By reading the information on demand instead of // storing it, the credentials will not be stored in // session, reducing the vulnerable surface area to the // web.config file, which can be secured with an ACL. // User name string userName = ConfigurationManager.AppSettings[Utility.Constants.AppConst.REPORT_USER].ToString(); if (string.IsNullOrEmpty(userName)) throw new Exception(Utility.Constants.AppConst.MESSAGE_MISSING_USER_NAME); // Password string password = ConfigurationManager.AppSettings[Utility.Constants.AppConst.REPORT_PASSWORD].ToString(); if (string.IsNullOrEmpty(password)) throw new Exception(Utility.Constants.AppConst.MESSAGE_MISSING_PWD); // Domain string domain = ConfigurationManager.AppSettings[Utility.Constants.AppConst.REPORTS_DOMAIN].ToString(); if (string.IsNullOrEmpty(domain)) throw new Exception(Utility.Constants.AppConst.MESSAGE_MISSING_DOMAIN); return new NetworkCredential(userName, password, domain); } } public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority) { authCookie = null; userName = null; password = null; authority = null; // Not using form credentials return false; } public Uri ReportServerUrl { get { string url = ConfigurationManager.AppSettings[Utility.Constants.AppConst.REPORT_SERVER_URL].ToString(); if (string.IsNullOrEmpty(url)) throw new Exception(Utility.Constants.AppConst.MESSAGE_MISSING_URL); return new Uri(url); } } public int Timeout { get { return int.Parse(ConfigurationManager.AppSettings[Utility.Constants.AppConst.REPORT_SERVER_TIME_OUT].ToString()); // return 60000; // 60 seconds } } public IEnumerable<Cookie> Cookies { get { // No custom cookies return null; } } public IEnumerable<string> Headers { get { // No custom headers return null; } } } 

Now in the AppSettings settings specify the following keys (or specify these values ​​anywhere):

  <add key="ReportServerUrl" value="http://sqlServerURL/ReportServer_SQL2008R2"/> <!--Development TargetReportFolder--> <add key="TargetReportFolder" value="/AppReporting/"/> <add key="ReportServerTimeOut" value="600000"/> <add key="ReportViewerServerConnection" value="FullyQualified Name of ur CustomReportServerConnection,ProjectName"/> <add key="ReportsUser" value="ReportUser"/> <add key="ReportsPassword" value="reportPassword"/> <add key="ReportsDomain" value="myDomain"/> 

Now, on the .aspx page, drag reportViewer something like this:

 <rsweb:ReportViewer ID="RptViewer" runat="server" AsyncRendering="False" SizeToReportContent="true" ProcessingMode="Remote" Width="100%" BackColor="#F7F8F9" OnReportError="RptViewer_ReportError" OnReportRefresh="RptViewer_ReportRefresh1" Height=""> </rsweb:ReportViewer> 

and customize your ReportViewer in code. place ReportParameter correctly.

it crushes you an idea ...

indicates that you need to authenticate properly, therefore, by creating your own custom ReportServerConnection

+3
source share

All Articles