views:

149

answers:

1

I have a asp.net c# web application with contains reports in remote processing mode. I am using the report-viewer control to render the reports. When I run the application in debug mode, I'm able to view my reports however when I publish the application to a different server I get this error message:

The request failed with HTTP status 401: Unauthorized.

My report server is on a different server than the location of my published web application. I have added new role assignment to my report server and also added to my web.config but the error persists. I think I am missing something in my aspx page for reportviewer.

Any input would be appreciated.

A: 

I'm assuming you already have set the server in your codebehind such as this

reportviewer.ServerReport.ReportServerUrl = "http://{server_ip}/reportserver";

or via the properties of the report viewer control. Make sure you change {server_ip} to the actual for the report server.

Other such problems I've seen in the past have to do with access for individual reports. Since this is cross-server, you'll need a proxy user set to view the reports.

Here are 2 examples from MSDN:

Example 1

Example 2

Madison
I have set the report server url as you have mentioned. Another test I tried is to go to my report server's url from the server where my application is published. It prompts me for my username/password and I'm able to view the reportserver when I domain_name/username and password. I looked at your link and tried to add this line: ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("username", "pwd", "domain"); and I've imported Microsoft.Reporting.Webforms but it says the type or namespace could not be found.
First, just want to make sure you replaced {server_ip} with the actual IP of the reportserver. Second, you actually need the include the class from the link provided so that it can be used as the server credentials. Try that and see if it fixes your problem. Good luck!
Madison
Thanks for the reply. I have already used my report server_ip for the reportserver url. I added the code from your Example2 to my code.This removed the error, however, now when I test my application and try to run a report locally it doesn't return anything. There is no error but there is no report either. I don't think it is accessing the reportserver url anymore even though I have specified that in my web.config file and my reportviewer.aspx file.Previously, the reports were working fine locally.
I have fixed this issue. My application is working on the test server now while accessing a different report server. It was an issue with my code being in Page_Load vs the Page_Init method. Thanks again for your input.