Closed Ncage1974 closed 6 years ago
Have you ensured that your web.config has the right binding redirect to point to the newer Autofac? NuGet can sometimes mess them up.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac"
publicKeyToken="17863af14b0044da"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.2.0"
newVersion="4.6.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
See the two occurrences of 4.6.2.0
in there? Make sure those are the version of Autofac you're actually referencing. (Like, if you're using 4.6.0
then make those 4.6.0.0
in both spots.)
@tillig thank you for the help and yes that did in fact fix the problem. I guess I've been used to nuget taking care of that in the past.
There is some type of dependency issue with the latest version of Autofac.WebApi2 (https://www.nuget.org/packages/Autofac.WebApi2/) on nuget. According to nuget these are the dependencies:
I already had Autofac 4.6.2 installed before i installed the package. Here is the error i get:
Playing around with versions of autofac it appears that 3.5.0 or 3.5.2 will work but as soon as you upgrade to >= 4.0.0 then you will get the error but according to the dependencies above it should work. I'm using .Net framework 4.6
Edit: Now i'm kind of stuck because Autofac.Mvc5 requires >=4.0.1 && < 5.0.0.