Tuesday 10 November 2009

Fixing a rsAccessDenied with the ReportViewer control

Today I got an access issue with ReportViewer control on SQL Server Reporting Services 2008. The issue has me stumped for a bit. The issue was that in the development environment it worked fine with no issues. The ReportViewer control was displaying the reports correctly. The the SSRS was installed on a different server to the web server which is a normal situation for a lot of people.

When we published the site to the internal test server and the ReportViewer would not display the reports. Again the server setup was the same as development just different servers.  In trying to debug the issue we noticed we were getting an access denied error for a particular user. It turns out that that ReportViewer control runs in the context of the default Windows identity which in the case of a web application is the application pool user.

When you try to set the ReportServerCredentials.NetworkCredentials in the web version of the ReportViewer control you get an error as this is property is read only.

SSRS The fix was to create a new Role Assignment on the Reporting Server for the application user. 

If you are using a local user for the application pool that hosts the web application you need to specify a domain user as per normal practice when setting up web applications that need to access resources across a domain.

Once the user was added to the Browser role in SQL Server Reporting Services the ReportViewer control could once again connect to the Reporting Server and display reports.

No comments: