I have deployed my ssrs project and reports on server. And now I have to consume those in my asp.net application. I have written basic code as I found on few links. But I think i am not passing correct server uri and rdl file path. Could you please let me know some key points to do this successfully?
What we have to give in this field reportViewer.ServerReport.ReportServerUrl=?
1) Is it the URL of report manager or its server path. Actually I have two things with me. One is the url and the other is Serverip with report server.I am using server name with Report server. But then also its not working
reportViewer.ServerReport.ReportServerUrl = new Uri("http://SomeIp/ReportServer");
If I try to navigate the URI, it shows me the directories in browser and the report also.That means its correct and working. I also have a URL of report manager with me. Should I have to pass that? But with that also it is not working.
2) Other thing I could be on wrong is report file path. Do i have to give file path from my application or is it the path of server directories where report is hosted or deployed. what exactly could be the path
If I navigate report manager url,http://films.braintech-dev.com/Reports
Here I can see SSRS Home with a folder named "film.Reporting" and in that I can see my report "FilmSummaryReport".
So I am using below as my file path
reportViewer.ServerReport.ReportPath = "/film.Reporting/FilmSummaryReport";
3) Or I could be wrong in .rdl extension. IS it required? But as per internet extension is not required.
By the way I am getting this error while using report viewer
Server Error in '/' Application.
The request failed with HTTP status 401: Unauthorized.
Please have a look on complete code
var objList = this._service.GetAllRecords()
ReportViewer reportViewer = new ReportViewer
{
ProcessingMode = ProcessingMode.Remote
};
IReportServerCredentials irsc = new ReportServerConnection("film12/srs", "ssrs123", "http://films.braintech-dev.com/Reports");
reportViewer.ServerReport.ReportServerCredentials = irsc;
reportViewer.ServerReport.ReportServerUrl = new Uri("http://SomeIp/ReportServer");
reportViewer.ServerReport.ReportPath = @"/film.Reporting/FilmSummaryReport";
reportViewer.Width = Unit.Percentage(100);
reportViewer.LocalReport.DataSources.Add(new
ReportDataSource("DataSet1", objList));
reportViewer.LocalReport.Refresh();
this.ViewBag.ReportViewer = reportViewer;
return this.View();