2016-04-15 7 views
0

Я запускаю свое приложение на сервере IIS, но теперь хочу выполнить некоторую отладку с точками останова и т. Д., Поэтому я решил запустить из Visual Studio в IIS Express , Но, когда я начинаю бежать мое приложение я получаю эту ошибку:Не удалось загрузить файл или сборку System.Web.Http.WebHost

Server Error in '/' Application.

Could not load file or assembly 'System.Web.Http.WebHost, Version=5.2.3.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)

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.Web.Http.WebHost, Version=5.2.3.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 13:
Database.SetInitializer(new TodoListServiceInitializer()); Line 14:
GlobalConfiguration.Configure(WebApiConfig.Register); Line 15:
} Line 16: } Line 17: }

Source File: C:\develop\spl_development\main\Docks\Docks_Sensor\Global.asax.cs
Line: 15

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

=== Pre-bind state information === LOG: DisplayName = System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///C:/develop/Spl_Development/Main/Docks/Docks_Sensor/ LOG: Initial PrivatePath = C:\develop\Spl_Development\Main\Docks\Docks_Sensor\bin Calling assembly : Docks.Sensor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\develop\Spl_Development\Main\Docks\Docks_Sensor\web.config LOG: Using host configuration file: C:\Users\ligthart\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: System.Web.Http.WebHost, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/25aafd2f/29cb2bd3/System.Web.Http.WebHost.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/25aafd2f/29cb2bd3/System.Web.Http.WebHost/System.Web.Http.WebHost.DLL. LOG: Attempting download of new URL file:///C:/develop/Spl_Development/Main/Docks/Docks_Sensor/bin/System.Web.Http.WebHost.DLL. WRN: Comparing the assembly name resulted in the mismatch: Build Number ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Stack Trace:

[FileLoadException: Could not load file or assembly 'System.Web.Http.WebHost, Version=5.2.3.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)]
Docks.Sensor.WebApiApplication.Application_Start() in C:\develop\spl_development\main\Docks\Docks_Sensor\Global.asax.cs:15

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http.WebHost, Version=5.2.3.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)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9966013
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) +352
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Http.WebHost, Version=5.2.3.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)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9947380 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

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

Я видел много вопросов, но не могу показаться, чтобы найти ответ на эту проблему. не я пошел искать, если какой-либо из требуемых файлов или ссылок отсутствовали .. но нет:

Ссылки:

enter image description here

бен папку:

enter image description here

версия:

enter image description here

Я попытался удалить папку BIN, все .. Я просто не могу заставить его работать. Я надеюсь, что есть решение, спасибо заранее!

ответ

0

удалить System.Web.Http.WebHost.dll и добавить в старой версии 4.0.0.0

0

Я была такая же проблема и попробовал решение, предоставляемое Hetal. Но теперь он дает ошибку в global.asax.cs в GlobalConfiguration.Configure (WebAPICOnfig.Register), что он не существует в библиотеке.

Смежные вопросы