2016-04-15 36 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

binフォルダ:

enter image description here

バージョン:

私はbinフォルダを削除しようとしてい

enter image description here

、すべて..私はちょうどそれが働くように見えることはできません。事前に感謝の意を表します。

答えて

0

System.Web.Http.WebHost.dllを削除して、私は同じ問題を持っていたとHetalによって提供される解決策を試してみました古いバージョン4.0.0.0

0

に追加します。しかし、GlobalConfiguration.Configure(WebAPICOnfig.Register)のglobal.asax.csには、ライブラリに存在しないというエラーが返されています。

関連する問題