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:
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
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.
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.
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:
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.
Stack Trace:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.547
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
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.
just installed fresh 6.2.1 and have same problem...
I Just upgraded to 6.2.0 and have the same problem
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)
Just had this issue ourselves when deploying to production. Got round it by changing this in the web.config:
to this:
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.
Thnx Andy Rose, worked perfected for me!
Works for me too! Thx!
Just did the trick for me as well thanks Andy!!! #H5YR
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.
is working on a reply...