0

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();
Sandy
  • 275
  • 3
  • 8
  • 25
  • Can you post your whole code block for this? You are correct in using the `"http://SomeIp/ReportServer"` – SS_DBA Aug 04 '17 at 15:20
  • I have added my code. Could you please have a look? – Sandy Aug 07 '17 at 06:16
  • Why are you switching From `ServerReport` to `LocalReport`? – SS_DBA Aug 07 '17 at 13:43
  • what should be the correct code? – Sandy Aug 08 '17 at 06:13
  • I think it's giving you `The request failed with HTTP status 401: Unauthorized.`, because you have setup the connection for `ServerReport`, but then you `Refresh()` on the `LocalReport`. Try changing to `ServerReport` for all of the logic. – SS_DBA Aug 08 '17 at 12:43

1 Answers1

0

If website that is running this is deployed and not running in Visual Studio then verify the user the application pool is running as has permissions to access the report.

Jason Webber
  • 323
  • 1
  • 4
  • 14
  • Actually the original password is "film12\srs" but c sharp is not allowing me backslash in a string . so i used "film12/srs". Can it also be the reason that it is still unauthorized. But there should be a relevant error like . Password doesn't matched or so? – Sandy Aug 07 '17 at 06:28
  • at very first instance I have not used network credentials. But now I have implemented IReportServerConnection and passed network connection also. I am not sure where I am wrong. – Sandy Aug 07 '17 at 06:37