Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pavel Gurecki 55 posts 158 karma points
    Jun 19, 2014 @ 17:17
    Pavel Gurecki
    0

    Could not load file or assembly 'System.Net.Http' - after upgrade to v 6.2.1

    Hi,

    after upgrading my 6.1.3 installation to 6.2.1 I've got "Could not load file or assembly 'System.Net.Http'"error on my staging server (full exception details below).

    Everything works on my local machine with .NET 4.5 installed.

    Removing following lines in web.config solves the problem:

          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
          </dependentAssembly>

    But I guess it is not recommended as it might affect other things (got error when installing 301 url tracker).

    Another fix is to install .NET 4.5 - did that on staging server and issue is fixed without removing lines from web.config.

    Is this means that Umbraco 6.2.1 requires .net 4.5?

    Or am I doing something wrong?

     

    Full stack trace:

    Could not load file or assembly 'System.Net.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Net.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Net.Http' 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].
    


    Stack Trace: 

    [FileLoadException: Could not load file or assembly 'System.Net.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
    
    [FileLoadException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
       System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
       System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
       System.Reflection.Assembly.Load(String assemblyString) +28
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
    
    [ConfigurationErrorsException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
       System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
       System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
    
    [HttpException (0x80004005): Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9093404
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.547

     

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jun 21, 2014 @ 17:26
    Jan Skovgaard
    0

    Hi Pavel

    The .NET 4 framework should be enough for v6.x to work - .NET 4.5 is only required for v7+ according to the system requirements document here http://our.umbraco.org/documentation/Installation/system-requirements

    So not sure why the above error happens :-/

    /Jan

  • Pavel Gurecki 55 posts 158 karma points
    Jun 23, 2014 @ 09:29
    Pavel Gurecki
    0

    Hi Jan,

    .NET 4 should be enough, but strange thing is that error goes away after installing 4.5.

    I am curiuous if anyone else is having similar problem.

  • Amigo 243 posts 568 karma points
    Jul 19, 2014 @ 07:56
    Amigo
    0

    just installed fresh 6.2.1 and have same problem...

  • Amalie Wowern 144 posts 273 karma points c-trib
    Jul 21, 2014 @ 11:14
    Amalie Wowern
    0

    I Just upgraded to 6.2.0 and have the same problem

  • karen 186 posts 461 karma points
    Aug 01, 2014 @ 23:08
    karen
    0

    I just upgraeded to 6.2.0 and worked fine on my local (which has .net 4.5)

    I moved to the dev server and now getting this error (dev server does NOT have 4.5)

    Removed those lines from the config and then it worked.

     

    However, is that safe to do on a production environment?

     Installing 4.5 on the dev/stage/prod environments is NOT an option)

  • andy_rose 91 posts 117 karma points
    Sep 11, 2014 @ 13:56
    andy_rose
    4

    Just had this issue ourselves when deploying to production. Got round it by changing this in the web.config:

      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    

    to this:

      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      </dependentAssembly>
    

    Not sure what this impact is, whether this is a nuget issue, or something has leaked into the v6 codebase which shouldn't have, but at least were up and running at the moment.

  • Kevin Gevers 1 post 21 karma points
    Sep 11, 2014 @ 17:00
    Kevin Gevers
    0

    Thnx Andy Rose, worked perfected for me!

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Oct 07, 2014 @ 01:37
    Michael Latouche
    0

    Works for me too! Thx!

  • Hywel Lewis 37 posts 138 karma points
    Nov 27, 2014 @ 08:24
    Hywel Lewis
    0

    Just did the trick for me as well thanks Andy!!! #H5YR

  • Daryl Teo 6 posts 28 karma points
    Mar 10, 2015 @ 04:45
    Daryl Teo
    0

    Just to help any future google sleuths around the place.

    The default web.config for 6.2 and above adds the above dependentAssembly to force System.Net.Http to version 4.0.0.0. However, 4.0.0.0 only ships with .NET 4.5, not .NET 4 which ships with 2.0.0.0.

    If you're targeting .NET 4, change the target version from 4.0.0.0 to 2.0.0.0 and it will compile. When you're ready to target 4.5, up to 4.0.0.0.

Please Sign in or register to post replies

Write your reply to:

Draft