locked
'ReportViewer' is ambiguous in the namespace 'Microsoft.Reporting.WebForms'. RRS feed

  • Question

  • User2127533128 posted


    I am using the report viewer 10 from visual studio 2010.  I have installed the redistributable for 2010 on the server, and  I have checked the gac, and the required files are on the server.  the previous version of the files are there too, I have read that this should be ok, I have tried to uninstall the old assemblies, but I have not been able too.  I am guessing it's getting confused somewhere.  I am wondering if you have seen this error before, and if anyone can offer advice on how to solve this

     
    Exception information:
        Exception type: HttpCompileException
     error BC30560: 'ReportViewer' is ambiguous in the namespace 'Microsoft.Reporting.WebForms'.
       at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
       at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
       at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
       at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
       at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

     
     

    Thursday, August 11, 2011 4:01 PM

All replies

  • User-573138384 posted

    You can have different versions of same dll in GAC. Its not an issue. The issue says 'ambiguous' reference. It occurs only when you hav different dlls with same class and you have reference to both dlls in your application. Its nothing to do with GAC. I believe you have references to two different version of the same dll in your application. Remove one of them.

    Thursday, August 11, 2011 8:16 PM
  • User2127533128 posted

    thanks for your response.  Are you talking about references in my web config?   My references refer to version 10 of the report veiwer.  I have placed version 10 of .dll in my bin folder too.  Thanks in advance for your assistance

    Friday, August 12, 2011 1:01 PM
  • User-573138384 posted

    Correct. In web.config under section assemblies, you would be having references. Check whether you have two entries in assemblies. Mean time you can check in project references too. Remove the ambiguous reference(same name with diff versions). I f you still confused, remove all references related to Reporting and add them again(make sure you add only reference and not its lower version).

    Friday, August 12, 2011 7:50 PM
  • User2127533128 posted

    that didn't solve it, i checked the assembly, and there is no duplicate entries.  This is a website, and not a project.  I am not saying the web.config is not the issue, but the report runs locally, and I get the error when i try to run from the server

    Saturday, August 13, 2011 8:35 PM
  • User-573138384 posted

    Thats what dear, the server GAC may have duplicate assembly.  Can you post your config? Does your assembly in config has public key token same as the GAC latest version dll? And the namespaces(imports in VB.NET) of the file in where exception is thrown and the statement(line) where the exception occurred(Are you using fully qualified name of the class?)

    Saturday, August 13, 2011 9:33 PM
  • User2127533128 posted

    I checked the web.config, and the assemblies on the server, and the public key token for Microsoft.ReportViewer.WebForms, and Microsoft.ReportViewer.Common are the same.

     I have installed the report viewer redistributable 2010,  is there a crystal runtime i need to install onto the server?

     

    my web.config

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
        Note: As an alternative to hand editing this file you can use the
        web admin tool to configure settings for your application. Use
        the Website->Asp.Net Configuration option in Visual Studio.
        A full list of settings and comments can be found in
        machine.config.comments usually located in
        \Windows\Microsoft.Net\Framework\v2.x\Config
    -->
    <configuration>
      <appSettings />
      <connectionStrings>
       
       

     


      </connectionStrings>
     
      <system.web>
        <sessionState mode="StateServer" cookieless="false" timeout="20" stateConnectionString="tcpip=127.0.0.1:42424" />
        <!--
                Set compilation debug="true" to insert debugging
                symbols into the compiled page. Because this
                affects performance, set this value to true only
                during development.

                Visual Basic options:
                Set strict="true" to disallow all data type conversions
                where data loss can occur.
                Set explicit="true" to force declaration of all variables.
            -->
        <roleManager enabled="true" />
         <httpHandlers>
          <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
        </httpHandlers>
        <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
          <assemblies>
            <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" />
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
          </assemblies>
      
          <buildProviders>
           <remove extension=".rdlc"/>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
          </buildProviders>
      
        </compilation>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
          <namespaces>
            <clear />
            <add namespace="System" />
            <add namespace="System.Collections" />
            <add namespace="System.Collections.Generic" />
            <add namespace="System.Collections.Specialized" />
            <add namespace="System.Configuration" />
            <add namespace="System.Text" />
            <add namespace="System.Text.RegularExpressions" />
            <add namespace="System.Linq" />
            <add namespace="System.Xml.Linq" />
            <add namespace="System.Web" />
            <add namespace="System.Web.Caching" />
            <add namespace="System.Web.SessionState" />
            <add namespace="System.Web.Security" />
            <add namespace="System.Web.Profile" />
            <add namespace="System.Web.UI" />
            <add namespace="System.Web.UI.WebControls" />
            <add namespace="System.Web.UI.WebControls.WebParts" />
            <add namespace="System.Web.UI.HtmlControls" />
          </namespaces>
          <controls>
            <add tagPrefix="cc1" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </controls>
        </pages>
        <!--
                The <authentication> section enables configuration
                of the security authentication mode used by
                ASP.NET to identify an incoming user.
            -->
        <!--<authentication mode="Forms"  />-->
        <authentication mode="Forms">
          <forms timeout="50000000" />
     </authentication>
      <!--  <identity impersonate="true" /> -->

       <!--
                The <customErrors> section enables configuration
                of what to do if/when an unhandled error occurs
                during the execution of a request. Specifically,
                it enables developers to configure html error pages
                to be displayed in place of a error stack trace.
     
            <customErrors mode="RemoteOnly" defaultRedirect="programerror.aspx">
                <error statusCode="403" redirect="noaccess.aspx" />
                <error statusCode="404" redirect="pagenotfound.aspx" />
            </customErrors>
          -->
        <machineKey validationKey="DAB094E49030AD48F80F3EE502B7574D77DB882BBF84B447562CDFA24CDD41BAD43BEBBAEFC684A7F7A741D1507128D893D08C548349E2494EB9066355849D0D" decryptionKey="56E668016A713928E355F774709BBFB3914E25146B01CBA8" validation="SHA1" />
        <customErrors mode="Off" />
        <!--<customErrors mode="RemoteOnly" defaultRedirect="programerror.aspx">
          <error statusCode="403" redirect="noaccess.aspx"/>
          <error statusCode="404" redirect="pagenotfound.aspx"/>
        </customErrors>-->
     
     
        <membership>
          <providers>
            <remove name="AspNetSqlMembershipProvider" />
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
          </providers>
        </membership>
      </system.web>
      <!--
            The system.webServer section is required for running ASP.NET AJAX under Internet
            Information Services 7.0.  It is not necessary for previous version of IIS.
        -->
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
            <!--<handlers>
                <add name="Reserved.ReportViewerWebControl.axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="Unspecified" preCondition="integratedMode" />
            </handlers>
            -->
            <handlers>
       <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </handlers>
      </system.webServer>
      <system.web.extensions>
        <scripting>
          <scriptResourceHandler enableCompression="false" enableCaching="true" />
        </scripting>
      </system.web.extensions>
    </configuration>

     

     

    Monday, August 15, 2011 11:29 AM
  • User1196771204 posted

    hi wgprop,

    have you made sure you just have one Crystal Report version installed on the server? May I know how did you host this report? Is that on a shared server? If it is, you need to check the details with your current host provider

    Monday, August 15, 2011 11:50 PM
  • User193795253 posted

    Was anyone able to resolve this ? I am getting the same thing compiler error cs0433

    The type 'Microsoft.Reporting.WebForms.ReportViewer' 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\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'

    Wednesday, December 14, 2011 8:45 PM