Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When iam adding report viewer it shows the following error ......i think the error may be in config file please help


HTML
ERROR
 Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'Microsoft.Reporting.WebForms.ReportDataSource' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL'

Source Error:


Line 398:        
Line 399:        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 400:        private global::Microsoft.Reporting.WebForms.ReportDataSource @__BuildControl__control7() {
Line 401:            global::Microsoft.Reporting.WebForms.ReportDataSource @__ctrl;
Line 402:            


Source File: c:\Users\user\AppData\Local\Temp\Temporary ASP.NET Files\root\590afed4\6e6a8864\App_Web_employeewisereport.aspx.cdcab7d2.4zmytqof.0.cs    Line: 400 




Web.Config

C#
<compilation debug="true">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="Microsoft.Build.Framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      </buildProviders>
    </compilation>



ASPX Page
ASP.NET
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>


<div class='form-vertical'>
                        <rsweb:ReportViewer ID="ReportViewer1"  runat="server" Font-Names="Verdana" 
                            Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
                            <LocalReport ReportEmbeddedResource="SyosysWap.Reports.rptEmployeeWise.rdlc">
                                <DataSources>
                                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" 
                                        Name="DataSetrptEmployee" />
                                </DataSources>
                            </LocalReport>
                        </rsweb:ReportViewer>
                        
                        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                            SelectMethod="GetData" 
                            TypeName="ds_EmployeeWiseTableAdapters.sp_Report_Web_EmployeesTableAdapter">
                        </asp:ObjectDataSource>
                        
                    </div>
Posted

I Solved by replaced the following version from 10 to 11 and its corresponding PublicKeyToken

C#
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />


REPLACED WITH

C#
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        <add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
 
Share this answer
 
There are various reasons for this issue and it is one you'll have to troubleshoot.

1. It can be because you have an extra web.config in a directory where it shouldn't be.
2. It can be because you have not specified a directory as a virtual directory in IIS that should be one.
3. It can be because you have an extra dll in your bin folder, perhaps one from a different project that also references ReportViewer.
4. Sometimes you can clear out the Temp ASP.Net folders and it will resolve.

The error is saying you have a conflict between 2 versions of the dll being referenced in your code.
 
Share this answer
 
Comments
Member 11581003 12-May-15 13:13pm    
Hi,

I am also having the same issue - I tried almost everything I could find on the web. I am too new to ASP.NET MVC and it is really very challenging.

Need extra help -
1. when it says "in a directory where it shouldn't be" - where all should I be looking?
2. How to specify a directory as a virtual directory in IIS?
3. How to take care of this (bin forlder is full of dll files)? which dll file? how to know what all is referencing
Reportviwer?
4. how to clear (more so, where to find the temp folders) the temp folders - I am really scared to delete anything.

As I said, I am too new to this - any guidance and help is truly appreciated.

Thanks
ZurdoDev 12-May-15 13:15pm    
I think Solution 2 is probably the one to look at first.
Member 11581003 12-May-15 15:15pm    
Thanks for your quick reply. Here is a little background - I am trying to incorporate .rdl file in ASP.NET MVC using an .aspx file. One time it worked (the first time) – at that time, the reportviewer width was small. I just changed the height and width values and tried to run again. Then it started giving this error.
Now whenever I run the application I am getting the following error.
Firefox - Report Viewer Configuration Error
IE - 0x800a1391 - JavaScript runtime error: 'Microsoft' is undefined
for
“$create(Microsoft.Reporting.WebFormsClient.ReportViewer, {"_internalViewerId":"ReportViewer2_ctl03","id":"ReportViewer2"}, null, null); “ statement.

I tried almost everything I could find on the web to solve this without any luck.
The things that I have tried so far –
• recreated another .aspx file and tried to put new reportviwer
• Uninstalled and reinstalled reportviewer
• Deleted and added back the references in my application
• Followed the steps below to make changes in IIS manager (*****see below)
• Compared my web.config file with the one that somebody posted which worked fine. When I did this and made changes to reportviewe section, the whole application stopped working. Then I had to revert it back.

One thing that happened last night was, it gave a warning about version conflict (One or more dependent assemblies have version conflicts. Do you want to fix these conflicts by adding binding redirect records in the application configuration file?) and I pressed "Yes" for resolving it. After that (I think it is after that), the web.config file has become very small. Most of the stuff is gone from that file but the application is working just fine except the reporting part.
I had the “Solution 2” statement yesterday in my web.config file. But now it is gone. As I said, my web.config file was long before but now it is really small.
I am not sure whether to delete the new (small) web.config file and replace it with the old one. I can share both (old as well as new) if you prefer to see.
I really don’t know what is going on. Help is truly appreciated.
Thanks a lot.
*****IIS Manager
• 1. Open Internet Information Services (IIS) Manager and select your Web application.
• 2. Under IIS area, double-click on Handler Mappings icon.
• 3. At the Action pane on your right, click on Add Managed Handler.
• 4. At the Add Managed Handler dialog, enter the following:
Request path: Reserved.ReportViewerWebControl.axd
Type: Microsoft.Reporting.WebForms.HttpHandler
Name: Reserved-ReportViewerWebControl-axd
• 5. Click OK.
ZurdoDev 12-May-15 15:20pm    
Please take all this information and post as a new question so that other people will also see it and can help you out.
Member 11581003 12-May-15 15:23pm    
OK

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900