cultivate passion for everything else that goes on around programming

Multiple Instances of Reporting Services 2008, one with custom authentication

Using Forms Authentication with Reporting Services 2008 worked fine based on the sample from code project:!Security%20Extension%20Sample&referringTitle=Home

But after I installed a second instance of Reporting Services 2008 on the same machine, the security extension did no longer work as expected. The problem was that the newly installed instance was using SSL, the first one did not. When I tried to login to the Reporting Services 2008 first instance, I received “The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel”. In the log files there was this error: “Remote certificate error RemoteCertificateChainErrors encountered for url”. This is how I found out that the security extension did not use the proper report server URL!

After debugging, I found the following problem and solution:

The security extension uses WMI in the following method to determine the ReportServerUrl:

internal static string GetReportServerUrl(string machineName, string instanceName)

When multiple instances are running, we have 2 ManagementObjects, even if we use the correct WMI path! The following picture shows that there are 2 MSReportsServer_Instance instances. imageSo

I changed the code to this:

foreach (ManagementObject instance in instances)

    // we are interested only for a specific instance
   var instanceNameProperty = instance.GetPropertyValue("InstanceName");
    if (instanceNameProperty != null && String.Compare(instanceNameProperty.ToString(), instanceName, true) != 0)

This way I correctly retrieve the reports’ server url of the specified instance.

For performance reasons, I think it would be much easier to hard code the URLs value into the web.config and not query the value through WMI. The disadvantage would be that if you change the Reporting Services 2008 configuration, you need to manually edit the web.config of the ReportServer too.


2 responses to “Multiple Instances of Reporting Services 2008, one with custom authentication

  1. Cam June 14, 2011 at 18:30

    This post helped me save a lot of time! It has very clear explanation and a solution that works.
    Thank you!

  2. Colin McNulty October 29, 2012 at 20:12

    I had the same problem. I’d identified what the issue was and tried your code, thanks.

    It didn’t work however, as it didn’t handle the fact that the code thinks the instanceName is MSSQLSERVER but the instance name as set in the ReportManager/web.config is RS_MSSQLSERVER. If you strip off the leading “RS_” it works fine.

    Thanks again.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: