我試圖在單聲道使用最新的Asp.Net的Web API,但錯誤這樣表示:未能加載類型「System.Web.Http.WebHost.Routing.HttpRouteExceptionHandler」在單
System.TypeLoadException
Could not load type 'System.Web.Http.WebHost.Routing.HttpRouteExceptionHandler' from assembly 'System.Web.Http.WebHost, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.
Exception stack trace:
at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache (System.Web.HttpContextBase context) [0x00054] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System.Web.Routing/System.Web.Routing/UrlRoutingModule.cs:128
at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache (System.Object o, System.EventArgs e) [0x00007] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System.Web.Routing/System.Web.Routing/UrlRoutingModule.cs:88
at System.Web.HttpApplication+<RunHooks>c__Iterator0.MoveNext() [0x001ba] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System.Web/System.Web/HttpApplication.cs:1050
at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext() [0x0073b] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System.Web/System.Web/HttpApplication.cs:1260
at System.Web.HttpApplication.Tick() [0x00000] in /Volumes/build-root-ramdisk/mono-3.4.0/mcs/class/System.Web/System.Web/HttpApplication.cs:932
Version Information: 3.4.0 ((no/c3fc3ba Thu May 1 22:52:17 EDT 2014); ASP.NET Version: 4.0.30319.17020
而且我應該通過Nuget包含哪些dll?目前我引用了這些程序集:
- System (from GAC)
- System.Web (from GAC)
- System.Web.Http (from Nuget)
- System.Net.Http.Formatting (from Nuget)
- System.Web.Http.WebHost (from Nuget)
- Newtonsoft.Json (from Nuget)
可能重複[無法加載類型'System.Web.Http.WebHost.HttpControllerHandler',在Mono/xsp4中](http://stackoverflow.com/questions/22219229/could-not -load型系統的Web-HTTP-的webhost-httpcontrollerhandler式單 - x)的 –