Monday, June 22, 2015

Running RDLC reports on Azure

After configuring and uploading the web app and its db, the ASPNET MVC worked perfectly until I tested the reports.
Started to check for answers and found a solution.

Errors that you may face, as below:-

  1. Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
     
  2. Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 
  3.  Could not find file 'D:\home\site\wwwroot\Views\Reports\ItemLabels.rdlc'. 
  4.  Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 


 So the errors 1,2 & 4 were clearly missing references and 3 was missing the rdlc file.
check on google and from this link on stackoverflow. I started adding one reference at a time.
so the solution was first to add new reference to the MVC web project and find the dlls from the GAC folder in "C:\Windows\assembly\GAC_MSIL\", each assemply have its own folder having different verstions, as I was using version 12, I selected that version for the below assemblies:-

  • Microsoft.ReportViewer.Common.dll
  • Microsoft.ReportViewer.ProcessingObjectModel.dll
  • Microsoft.ReportViewer.WebForms.dll (was already added)
  • Microsoft.ReportViewer.DataVisualization.dll

Steps: after selecting add referece, click on browse, and enter the path "C:\Windows\assembly\GAC_MSIL\", select each of the above folder and select the correct dll version for your application


On my local machine I had version 10,11 &12, 

Inside the version 12 folder there was one dll only, so I selected it.


And it appeared in the references as any dll 




All the the above need to have there property copy to local set to true.

And beware that the size of the dlls may go up to 10mb.


upload the RDLC file as I was still debugging.

The RDLC reports worked fine




3 comments:

  1. guy.. how about in webform project with vb.net?

    ReplyDelete
    Replies
    1. It will be the same steps, please update me if I can help in anyway

      Delete
  2. Thanks. This saved me probably half a days work. I've had this issue with a previoush application and could not remember how to resolve it. Tried adding and removing some references, but as I see now there were references that were completely missing. Working fine on localhost, but once published to Azure, the errors started happening.

    I also had to add the rdlc files manually as the publish process did not include them.

    ReplyDelete