views:

919

answers:

3

I would like to Publish my web application and view a report with the Microsoft ReportViewer. Everything works locally but when published I've encountered a troubling number of errors. Finally I seem to have come across one that I cannot fix.

So far I have solved the first 3 problems by...

  1. Installing the Miscrosoft Report Viewer Redistributable 2008
    package on my server.
  2. Changed my "rdlc" file to be "Content" and removed the rdlc buildProvider in the web.config file.
  3. Configured the Managed Handler in IIS for the ReportViewer

Finally, the ReportViewer is at least visible and it "seems" to be trying to load the report. BUT Now I'm getting the following error:

[InvalidCastException: Unable to cast object of type 'Microsoft.Reporting.WebForms.ReportHierarchy' to type 'Microsoft.Reporting.WebForms.ReportHierarchy'.] Microsoft.Reporting.WebForms.ReportDataOperation..ctor() +253 Microsoft.Reporting.WebForms.HttpHandler.GetHandler() +669 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +13
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Oh great! Of course you can't cast an object to the type that it already is!!!! Does anybody know how to fix this one?

Thanks,
Justin

A: 

If you don't have Visual Studio upgraded to SP1, you need to upgrade as per this MSDN thread.

roman m
Thanks for the suggestion but that is not the issue. I have VS 2008 SP1 installed on my dev machine. And .Net Framework SP1 and the Report Viewer Redist SP1 on the web server.
Justin
A: 

Do you have .Net 3.5 SP1 installed on the server?

Roger
Yes. Thanks for checking though.
Justin
A: 

Well turns out when I did step 3. "Configured the Managed Handler in IIS for the ReportViewer"

I registered the wrong one. The system had a v8.0 and a v9.0. 50-50 odds of picking the wrong one and I won.

Let this be a lesson to people who think dialog boxes don't need to be resizable... THEY ALWAYS SHOULD so you can see the content. The version number is not visible in the dropdown you are staring at 2 identical entries to the eye!!!

Anyways... if you encounter this problem check that you're version in Visual Studio matches your Managed Handler on the report server machine.

Justin