Monday, March 15, 2010

Fix to Report viewer problems in IIS 7 or later

When we migrate web applications from IIS 6 to IIS 7 or IIS 7.5, we will face some problems in http handlers, mappings etc. I faced some problems with reportviewer control. So, below are all problems I have faced and solutions to them. And one more thing is, the server to which we migrated the application may or may not have all the report viewer dlls available in the system. If they didn't install then we need to install them. Otherwise you will get compilation error as we are using that in our application.

First of all, before proceed what are the dlls needed for the report viewer to run?
Microsoft.reportviewer.common.dll
Microsoft.reportviewer.processingobject.dll
Microsoft.reportviewer.webforms.dll
Microsoft.reportviewer.winforms.dll - For windows applications.

So, to get the dlls you need to install the redistributable packages for 2005/2008. Below are details to get that. Find the matched version[2005/2008] and isntall the correct patch. Once installed you will find all above dlls in the GAC.

Microsoft Report Viewer Redistributable 2008
File name : ReportViewer.exe
Version : 9.00.21022.08
Download Size : 2.8 MB

Microsoft Report Viewer Redistributable 2005
File name : ReportViewer.exe
Version : 2007
Download Size : 1.8 MB

Microsoft Report Viewer Redistributable 2005 SP1 (Upgrade)
File name : VS80-KB933137-X86.exe
Version : 1
Download Size : 1.7 MB

Microsoft Report Viewer Redistributable 2005 SP1 (Full Installation)
File name : ReportViewer.exe
Version : 1.0
Download Size : 1.8 MB

ReportViewer Samples for Microsoft Visual Studio 2008
File name : ReportViewerSamples2008.exe
Version : 1.0
Download Size : 172 KB

ReportViewer Samples for Visual Studio 2005
File name : ReportViewerSamples.exe
Version : 1.0
Download Size : 173 KB

With the installed patch, you can solve the compilation error. But, the report viewer control won't render correctly on the browser. What are the possible problems come?
  1. 'RSClientController' is undefined
  2. Report resource images are not coming or loading.
  3. RSParamaters  not defined.
  4. ReportViewerHoverButton not defined etc...
  5. Other javascript errors which caused the report viewer failed to load correct.
The only fix to the problems are below.
Solution:
We need to configure the report viewer auto generated axd files[Reserved.ReportViewerWebControl.axd] in the IIS.
See below pictures to understand it well.
1. Open the IIS by typing the "inetmgr" in run command.
2. Goto your site in the list of web sites and select it as shown below.
3. Now, see the Features view area. Here, you can see all options available for the web site. From all the options select "Handler Mappings".
4.  Now, click on the "Handler Mappings" section then you will see all the mappings applied for that web site. Now, on the right side panel, you are able to see all the options available for the handler mappings. Select the option "Add Managed Handler" as shown below.
5. When you click that link, you will see a popup window with the text boxes as shown below.
Fill, Path = Reserved.ReportViewerWebControl.axd,
Type = Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Name= Reserved.ReportViewerWebControl.axd
Note: Please change the version number[9.0.0.0] in the Type above given depends on your requirement.
6. Click OK and do IISRESET.
Now, browse the page where you have report viewer control. And you see no more issues and everything renders fine. Hope this will help you to understand well and please let me know, if you have any questions or issues.

35 comments:

  1. This Turkish
    "Süpersin"
    "Çok teşkkür ederim."

    ReplyDelete
  2. I like what you're doing here. Very interesting! I've got your message in this other site that you are proposing trading subs. So, i jumped on it, and here I am, already subscribed via e-mail.
    My place is at:
    http://stillmind-thoughts.blogspot.com
    If you have the time to read some I'm sure you'll like it.
    In any case, keep up the good work! I'm sure that lots of people appreciate it.
    Best,
    René ~stillmind~

    ReplyDelete
  3. Can the same thing be achieved by modifying the web.config file?

    ReplyDelete
  4. I must run IIS in classic mode. How do I achieve this?

    ReplyDelete
  5. What's the problem in using classic mode? I didn't say anything the account application should run right? Can you please post the problem here, so that I will get chance to look into them.

    ReplyDelete
  6. Hi Praveen,

    I'm having some problems with getting this to work. I've followed your steps, but I get this error:
    The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add to the system.web/httpHandlers section of the web.config file.

    Which is basically telling me to do what I've already done. If I put that entry in the system.web/httpHandlers section, it does not run at all. Instead I've got it in system.webServer/handlers (where IIS put it after following your steps). The problem, I believe, comes from trying to run in Integrated Mode. Do you have any suggestions?
    Shaun

    ReplyDelete
  7. Hi Shaun,
    Your web.config for HttpHandlers section should looks like this.
    <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    validate="false" />

    And add the assemblies to the web.config to register them before we use them. It is under <assemblies> section.
    <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

    Let me know,if that didn't solve the problem.

    ReplyDelete
  8. Oh sorry. I didn't read the comment correctly. You said, you are running in integrated mode. For this,
    Please read complete details here.
    http://msdn.microsoft.com/en-us/library/ms251661.aspx
    [Scroll down till last and check]

    Good luck.
    -Praveen.

    ReplyDelete
  9. So, I've followed all those steps, and I have what that website says to have, yet it's still giving me the same error where it just tells me to put that key in the system.web/httpHandlers section. If I do have it in there, though, it (as that website said) gives me an error. It seems that no matter what I get this error.

    ReplyDelete
  10. ok, can you please let me know below details for further investigation?
    1. Did you install the redistributable package in the server?
    2. What is the version of reportviewer you have installed. 8.0 or 9.0?
    3. ARe you able to see the dlls mentioned in the post in GAC?
    4. Can you paste the web.config in here if possible?

    thanks
    -Praveen.

    ReplyDelete
  11. Excellent post, it helps me a lot!! Thank you very much!

    ReplyDelete
  12. Hi,

    I too am facing an issue with using Reportviewer Control in SSRS integration mode. The exception that I get is :

    "Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.\r\nThe request failed with the error message:
    ..rest of the error has been cut to accomodate in the space provided.

    Kindly help...

    ReplyDelete
  13. Hi, Can you please give me more details like, how are you getting this error?
    1. Are you using report server web service in your code?
    2. Is report server url working? If it is coming "service unavailable", then only these kind of errors come.
    3. The user accessing the report server has access to it?

    So, the only reason I am asking is, better understanding of what you are doing and when the error is coming. Please post that information to help you out. Good luck.

    ReplyDelete
  14. This is awesome! Helped me resolve the problems I had when trying to publish a site at work. Can't thankyou enough

    ReplyDelete
  15. I have been struggling with this problem for a week .

    your help was precious
    Thank you

    ReplyDelete
  16. Hi Praveen,

    I accidentally Add Managed Handler on IIS6. How can i revert it back?

    ReplyDelete
  17. Awesome!! Thanks for the post.

    ReplyDelete
  18. It appears that ReportViewer 8.0 (2005) and 9.0 (2008) must run under Classic mode in IIS7. ReportViewer 10.0 (2010) does work under Integrated mode.

    http://msdn.microsoft.com/en-us/library/ms251661.aspx (last section on httHandlers)
    http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/b2ef1892-943d-4f83-981b-6e9d7f2bac4e
    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a941c6b2-64dd-4d03-9ca7-4017a0d164fd&displaylang=en

    ReplyDelete
  19. Awesome!! Great finding and wonderful thought to share with the community. Thanks a ton, Praveen. You resolved the issue that I was struggling with for the last 2 days.
    - Jona

    ReplyDelete
  20. You just saved my life, thank you very much!

    ReplyDelete
  21. Thanks a lot.. my web.config was missing entries under the assemblies section.. just added and resolved the issue..

    Thanks, keep up the good work.

    Ramesh Jogadiya

    ReplyDelete
  22. Thanks so much. i searched for 2 days. final got the link and fixed it.

    ReplyDelete
  23. hi,
    i`m getting 500 err0r when i`m trying to access share point. in IIS 6.0 ,and the error is Exception_Report_Handler.can you please explain me the process ,how to trouble shoot that.

    Thank You In Advance

    ReplyDelete
  24. This worked excellent thanks! Even applies to windows 2012

    ReplyDelete
  25. Users also need to under restrictions if you are using windows 2012 and uncheck "Invoke handler only if request is mapped to:" I had forgotten for one website I unchecked this and I tried your steps with the other website to no availe until I looked under restrictions and noticed this was checked.

    ReplyDelete
  26. Worked excellent thanks...

    ReplyDelete
  27. Hi Praveen,

    I have tried all your options but still giving the same error RSClientPrint undefined.Here is my scenario.

    Report server is in native mode and I'm trying to print the report from a sharepoint site running in IIS 7.0

    1. run RsViewer 9.0 version
    2. Added Http handler to web.config
    3. Added assemblies to web. config
    4. Verified all assemblies in GAC
    5. Added Managed handler.

    Could you please shed some light on this issue.

    Thanks in advance

    ReplyDelete
  28. Hi Thanks. I was very new to Report viewer. I was able to figure it out what was the error by reading your Post.

    Thanks,
    VIJAY

    ReplyDelete
  29. Hi praveen,

    Developed the rdl in reportserver and calling from the C# Application using Reprotviewer 9.0 and some report parameter added from the application.
    it's working in local but not working in client machine,I got the below error
    please help me.

    My Mail id:sureshmca611@gmail.com

    Client Machine: IIS 7.0 and 64-bit,Reportviewer distributable version 9.0




    Webpage error details


    User Agent: Mozilla/4.0 (compatible; MSIE 8.0;
    Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727;
    .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
    Timestamp: Mon, 24 Jun 2013 14:17:16 UTC


    Message: Expected ')'
    Line: 644
    Char: 19
    Code: 0
    URI: http://192.168.15.27/LiveTestOne
    /Matrix/CRTReportSentToClient.aspx

    ReplyDelete
  30. Hello Sir,
    I have an asp.net application which is displaying the report using crystal report.The application is working properly on my local PC.I deployed this application on our dedicated server.But the following error occurring....
    Retrieving the COM class factory for component with CLSID {5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error: 80070005...
    pls give a reply..
    Regards,
    Janvi
    Email: janviracheljohn@gmail.com

    ReplyDelete
  31. Hi Janvi,
    The issue is with the permissions in accessing the reports. You must give access to the IIS users as mentioned in below article to resolve the issue: http://forums.asp.net/t/1571578.aspx/1

    If still the issue exists let me know.

    ReplyDelete
  32. Thanks a lot man!
    really that solved my problem
    So grateful

    ReplyDelete
  33. This comment has been removed by a blog administrator.

    ReplyDelete