none
Could not load file or assembly 'System.Web.Extensions

    Question

  • Hi all,

    My website project is running on framework 2.0, it was started built using the vs2005. After that, i've converted it to the vs2008 and the target framework is 2.0, everything works fine.

    I also have the (System.Web.Extensions, Version=1.0.61025.0) in my BIN folder.

    Same way, under the same production environment running the framework 2.0, recently I have converted website to the vs2010 with the same target Framework 2.0 also, now it has problem.

    When i build the website using vs 2010 and publish it, i get these error when i access my site

    "Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”.

    I've deleted all the reference and manually point System.Web.Extensions.dll version 1.0 to the BIN again, it still the same error.

    But when i back to vs2008 and build it again and publish to the production server it is working great.

    I've been looking around for the solution, but I failed to get any solution

    Any expert have solution on this??

    My condition exactly same as what was discuss here i this link http://forums.asp.net/t/1605823.aspx/1/10 , seems nobody know the solution

    Thanks

    Friday, April 22, 2011 7:05 AM

All replies

  • can you post the whole web.config please.
    Friday, April 22, 2011 7:25 AM
  • Hi the this is the web.config, thanks

    <?xml version="1.0"?>
    <!--
        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 xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
     <configSections>
      <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
         <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
         <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
         <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
        </sectionGroup>
       </sectionGroup>
      </sectionGroup>
     </configSections>
     <appSettings>
      <!-- Make use of SQL Server DALs -->
       </appSettings>
     <connectionStrings>
      <add name="lll" connectionString="Password=kangaroo;Persist Security Info=True;User ID=sa;Initial Catalog=lll_temp;Data Source=vmhost\vmhost2;MultipleActiveResultSets=true;Pooling=false;" providerName="System.Data.SqlClient"/>
    l </connectionStrings>
     <system.web>
      <!-- adding config for atlas to work-->
      <!-- end for atlas-->
      <pages>
       <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
       </controls>
       <tagMapping>
        <add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>
        <add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>
       </tagMapping>
      </pages>
      <!--
                Set compilation debug="true" to insert debugging
                symbols into the compiled page. Because this
                affects performance, set this value to true only
                during development.
            -->
      <compilation debug="true">
       <assemblies>
        <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
          </assemblies>
      </compilation>
      <!--
                The <authentication> section enables configuration
                of the security authentication mode used by
                ASP.NET to identify an incoming user.
            -->
      <roleManager enabled="true" cacheRolesInCookie="true">
      </roleManager>
      <!--testing
        <authorization>
          <allow roles="Admin" />
          <deny users="*"/>
        </authorization>
       
      
        <siteMap defaultProvider="AAA" enabled="true">
          <providers>
            <add name="AAA" type=".."
              siteMapFile="web.sitemap"
              securityTrimmingEnabled="true" />
            </providers>
      </siteMap>-->
      <!--  <siteMap defaultProvider="defaultProviderName">
              <providers>
                <add name="name" type="type" />
              </providers>
            </siteMap>
    -->
      <authentication mode="Forms"/>
      <!--
                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="GenericErrorPage.htm">
                <error statusCode="403" redirect="NoAccess.htm" />
                <error statusCode="404" redirect="FileNotFound.htm" />
            </customErrors>       
          <error statusCode="403" redirect="~/System/error_permission.aspx"/>
            -->
        <customErrors mode="Off" defaultRedirect="~/Error/CustomErrorPage.aspx">
          <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
      <httpHandlers>
       <remove verb="*" path="*.asmx"/>
       <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
      </httpHandlers>
      <httpModules>
       <add type="nnn.lll.Web.AppModule" name="AppModule"/>
       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
       <!-- <add name="SecurityHttpModule" type="lllRoles.SecurityHttpModule" />-->
      </httpModules>
      <httpRuntime maxRequestLength="7168"/>
     </system.web>
    </configuration>


    • Edited by suchin_see Friday, April 29, 2011 2:25 AM
    Friday, April 22, 2011 7:43 AM
  • This is the error page when accessing my website

     

    Server Error in '/Backend' Application.
    --------------------------------------------------------------------------------

    Parser Error
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    Source Error:


    Line 1:  <%@ master language="C#" autoeventwireup="true" inherits="Main, App_Web_ucl3c41r" %>
    Line 2:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Line 3:  <html xmlns="http://www.w3.org/1999/xhtml">
     

    Source File: /Backend/Main.master    Line: 1

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.


    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

     


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

    Friday, April 22, 2011 7:45 AM
  • There is some DLL in your project that you are referencing that is based on the .Net framework 4.0, which incidently references the missing DLLs. Can you check all the DLLs in your references folder to check whether all are dependent on 2.0 only. Do this for all the dependent projects too that the Service refers to.
    Friday, April 22, 2011 7:51 PM
  • There is some DLL in your project that you are referencing that is based on the .Net framework 4.0, which incidently references the missing DLLs. Can you check all the DLLs in your references folder to check whether all are dependent on 2.0 only. Do this for all the dependent projects too that the Service refers to.

     

    I've just solved by copying

    System.Web.Extensions.Design.dll

    System.Web.Extensions.dll

    into the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder then now it can be published and viewed. Any one know why it doesn't refer to the two DLLs inside my BIN folder??? When i tried to refer the DLLs to the BIN folder, it auto refer to GAC.

    Monday, April 25, 2011 5:46 AM
  • The GAC always takes precedence.

    The order of precedence is explained here...

    http://msdn.microsoft.com/en-us/library/yx7xezcf%28VS.71%29.aspx

    Monday, April 25, 2011 6:15 PM
  • The GAC always takes precedence.

    The order of precedence is explained here...

    http://msdn.microsoft.com/en-us/library/yx7xezcf%28VS.71%29.aspx

     

    The vs2010 in that machine is new freshed installation

    I've just checked, the DLL is not registered in the GAC, but why vs2010 auto referring to them. Any explaination for this? Thanks

    The DLL i meant is System.Web.Extensions, Version=1.0.61025.0


    Tuesday, April 26, 2011 9:49 AM
  • Check your temporary folder. There could be some artifacts that are being referenced from there.

    Use this thread as a reference.

    Tuesday, April 26, 2011 4:09 PM
  • Also, you might have gotten away with copying the DLLs on the local folder and getting this to work. But when you deploy it to an environment where only the 2.0 version of the .Net Framework is present, you will run into problems. I'd rather say that you figure out what the root cause of the problem is, as opposed to a short time patching. Just a recommendation.
    Friday, April 29, 2011 6:39 PM
  • To resolve this, read up the following blog by Whitehorn

     

    http://geekswithblogs.net/jwhitehorn/archive/2007/07/03/113660.aspx

     

     

    Wednesday, November 09, 2011 1:40 PM
    • Proposed as answer by waizkode Wednesday, November 09, 2011 1:47 PM
    • Edited by waizkode Wednesday, November 09, 2011 1:48 PM
    Wednesday, November 09, 2011 1:45 PM
  • Please follow the below steps.

    1) remove the System.Web.Extensions reference.

    2) Paste the System.Web.Extensions.Dll (latest 4.0) file into your Bin folder and also check in your webconfig file which one is referening.

    3) Add System.Web.Extensions 4.0 reference to your solution

    4) Build the solution and check.

    Friday, January 20, 2012 7:39 AM
  • I ran into this issue, b/c I was asked to work on a legacy site at work running .net 2 with the old web extensions that came with AJAX 1 for ASP.net.

    I tried some of the other items in this post and struggled on finding the right fix for me as I converted my web site to a VS 2010 solution.  I had version 3.5 of System.Web.Extensions, but needed the 1.6 or whatever.

    So I downloaded http://www.microsoft.com/en-us/download/details.aspx?id=883 the Ajax 1.0 toolkit by itself which loaded the System.Web.Extensions v1.6 into my GAC on my Windows 7 machine, and I am rollin' in my 64.

    Hope this helps someone else. :)

    Tuesday, May 29, 2012 9:14 PM
  • its working for me too, thanks

    Wednesday, April 17, 2013 12:20 PM