Tuesday, 19 June 2012

SSRS Web Service Insufficient Permissions

Error: System.Web.Services.Protocols.SoapException: The permissions granted to user are insufficient for performing this operation

I had this error recently when trying to connect to a SSRS Report Server vis Web Services using the code below.

rsExec = new ReportExecutionService();
//Get App setting valuesstring authenticationMode = "Windows";
string serverUrl = "http://server/ReportServer";
string userName = "username";
string password = "password";
string domain = "domain";
rsExec.Url = serverUrl.TrimEnd('/') +"/ReportExecution2005.asmx";
// Need to do different things depend on the authentication mode.
if (authenticationMode == SSRSAuthenticationModeEnum.Windows.ToString())
       rsExec.Credentials = CredentialCache.DefaultCredentials;
       rsExec.Credentials = new NetworkCredential(userName, password, domain);

ExecutionInfo ei = rsExec.LoadReport(reportPath, null);
rsExec.SetExecutionParameters(parameters, "en-us");
result = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);

The issue was that I was using "Windows" authentication and my SSRS Server was on a seperate machine to my web server. Once I changed my Authentication mode to "Forms" and provided some admin credentials it worked fine.

I beleive the issue only happens if you have multiple server environments. If the SSRS Server and Web Server are on the same machine I don't get this issue.

For reference I also found this blog post which although not helpful for me seems like it might be helpful for others.