Using Forms Authentication with Reporting Services 2008 worked fine based on the sample from code project:
http://msftrsprodsamples.codeplex.com/wikipage?title=SS2008!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.
So
I changed the code to this:
foreach (ManagementObject instance in instances)
{
instance.Get();
// we are interested only for a specific instance
var instanceNameProperty = instance.GetPropertyValue("InstanceName");
if (instanceNameProperty != null && String.Compare(instanceNameProperty.ToString(), instanceName, true) != 0)
{
continue;
}
...
}
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.
Like this:
Like Loading...
Related
This post helped me save a lot of time! It has very clear explanation and a solution that works.
Thank you!
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.