После обновления моего проекта от Autofac 2.6.3.862 до 3.4.0.0 у меня была следующая ошибка. Я даже не добавлял никаких ссылок на Autofac 3.3.0.0 в любом проекте в решении.Не удалось загрузить файл или сборку Autofac, Version = 3.3.0.0
=== Pre-bind state information ===
LOG: DisplayName = Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
(Fully-specified)
LOG: Appbase = file:///C:/Projects/Drive/temp/drive/Src/Web/
LOG: Initial PrivatePath = C:\Projects\Drive\temp\drive\Src\Web\bin
Calling assembly : Autofac.Configuration, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\Drive\temp\drive\Src\Web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
LOG: Attempting download of new URL file:///c:/temp/root/79371609/925ee10/Autofac.DLL.
LOG: Attempting download of new URL file:///c:/temp/root/79371609/925ee10/Autofac/Autofac.DLL.
LOG: Attempting download of new URL file:///C:/Projects/Drive/temp/drive/Src/Web/bin/Autofac.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
Fairfax.Classifieds.Drive.Web.Global.RegisterTypesWithAutofac() in c:\Projects\Drive\temp\drive\Src\Web\Global.asax.cs:375
Fairfax.Classifieds.Drive.Web.Global.Application_Start(Object sender, EventArgs e) in c:\Projects\Drive\temp\drive\Src\Web\Global.asax.cs:102
[HttpException (0x80004005): Could not load file or assembly 'Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9936485
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Could not load file or assembly 'Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' 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) +9950728
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
UPDATE: Я также добавил узел перенаправления привязки к web.config, но все-таки была ошибка.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="5.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" />
<bindingRedirect oldVersion="1.0.0.0-3.4.0.0" newVersion="3.4.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Я также попытался добавить Autofac 3.3.0.0 в GAC, но это было неэффективно.
я, наконец, понизить Microsoft.AspNet.Mvc до 5.1.0, 3.4.0 Autofac. –
Я получаю аналогичную ошибку, добавляя ссылку WCF. Похоже, Autofac.Integration.Wcf хочет Autofac 3.3, но у меня Autofac 3.5. Предлагаемая ниже переадресация привязки уже присутствовала и не помогает. Это помогает во время компиляции, как я вижу в журналах сборки, но не при добавлении ссылки на службу. «Не удалось загрузить файл или сборку« Autofac, Version = 3.3.0.0, Culture = neutral, PublicKeyToken = 17863af14b0044da »или одну из его зависимостей. Система не может найти указанный файл». –
У меня была такая же проблема, но Clean и Rebuild исправили ее после изменения Web.config – cederlof