Asp.net mvc 4 移动到Web API RC,获取:未找到方法:';System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get#u servicesolver()';

Asp.net mvc 4 移动到Web API RC,获取:未找到方法:';System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get#u servicesolver()';,asp.net-mvc-4,asp.net-web-api,Asp.net Mvc 4,Asp.net Web Api,我将一个站点从WebAPI Beta移动到WebAPI RC,现在加载该站点时出现错误:未找到方法:“System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_servicesolver()。 第一次尝试注册我的AutoFacWebApiDependencyResolver(按照说明)时发生错误: stacktrace显示以下内容: [MissingMethodException: Meth

我将一个站点从WebAPI Beta移动到WebAPI RC,现在加载该站点时出现错误:
未找到方法:“System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_servicesolver()。

第一次尝试注册我的
AutoFacWebApiDependencyResolver
(按照说明)时发生错误:

stacktrace显示以下内容:

[MissingMethodException: Method not found: 'System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_ServiceResolver()'.]
   System.Web.Http.GlobalConfiguration.<.cctor>b__0() +0
   System.Lazy`1.CreateValue() +12775823
   System.Lazy`1.LazyInitValue() +355
   StatusBoard.Web.MvcApplication.RegisterDependencyInjection() in C:\path-tp-app\Global.asax.cs:125
   StatusBoard.Web.MvcApplication.Application_Start() in C:\path-to-app\Global.asax.cs:75
private static Lazy<HttpConfiguration> _configuration = new Lazy<HttpConfiguration>((Func<HttpConfiguration>) (() =>
{
  local_0 = new HttpConfiguration((HttpRouteCollection) new HostedHttpRouteCollection(RouteTable.Routes));
  local_0.get_ServiceResolver().SetService(typeof (IBuildManager), (object) new WebHostBuildManager());
  return local_0;
}));
private static Lazy<HttpControllerDispatcher> _dispatcher = new Lazy<HttpControllerDispatcher>((Func<HttpControllerDispatcher>) (() => new HttpControllerDispatcher(GlobalConfiguration._configuration.Value)));

public static HttpConfiguration Configuration
{
  get
  {
    return GlobalConfiguration._configuration.Value;
  }
}
[MissingMethodException:找不到方法:'System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_ServiceResolver()'
System.Web.Http.GlobalConfiguration.b__0()+0
System.Lazy`1.CreateValue()+12775823
System.Lazy`1.LazyInitValue()+355
C:\path tp app\Global.asax.cs:125中的StatusBoard.Web.mvcapapplication.RegisterDependencyInjection()文件
C:\path to app\Global.asax.cs:75中的StatusBoard.Web.mvcapapplication.Application\u Start()
基于此,该错误似乎发生在静态GlobalConfiguration类的初始化过程中。当我深入到该类的源代码时,我看到以下内容:

[MissingMethodException: Method not found: 'System.Web.Http.Services.DependencyResolver System.Web.Http.HttpConfiguration.get_ServiceResolver()'.]
   System.Web.Http.GlobalConfiguration.<.cctor>b__0() +0
   System.Lazy`1.CreateValue() +12775823
   System.Lazy`1.LazyInitValue() +355
   StatusBoard.Web.MvcApplication.RegisterDependencyInjection() in C:\path-tp-app\Global.asax.cs:125
   StatusBoard.Web.MvcApplication.Application_Start() in C:\path-to-app\Global.asax.cs:75
private static Lazy<HttpConfiguration> _configuration = new Lazy<HttpConfiguration>((Func<HttpConfiguration>) (() =>
{
  local_0 = new HttpConfiguration((HttpRouteCollection) new HostedHttpRouteCollection(RouteTable.Routes));
  local_0.get_ServiceResolver().SetService(typeof (IBuildManager), (object) new WebHostBuildManager());
  return local_0;
}));
private static Lazy<HttpControllerDispatcher> _dispatcher = new Lazy<HttpControllerDispatcher>((Func<HttpControllerDispatcher>) (() => new HttpControllerDispatcher(GlobalConfiguration._configuration.Value)));

public static HttpConfiguration Configuration
{
  get
  {
    return GlobalConfiguration._configuration.Value;
  }
}
private static Lazy\u配置=new Lazy((Func)(()=>
{
local_0=新的HttpConfiguration((HttpRouteCollection)新的HostedHttpRouteCollection(RouteTable.Routes));
local_0.get_servicesolver().SetService(typeof(IBuildManager),(object)new WebHostBuildManager());
返回本地_0;
}));
私有静态惰性_dispatcher=new Lazy((Func)(()=>newhttpcontrollerdispatcher(GlobalConfiguration._configuration.Value));
公共静态HttpConfiguration
{
得到
{
返回GlobalConfiguration.\u configuration.Value;
}
}
这里的第四行似乎是问题所在-它试图调用一个get_servicesolver()方法,该方法在
HttpConfiguration
类中不再存在(应该是
DependncyResolver


这只是RC for WebAPI的一个bug吗?有什么办法可以让我绕过这件事吗?或者我被困在某个DLL/Nuget地狱中(如果是这样,我如何才能脱身)?

依赖解析已完全用RC重新编写。最好是卸载测试版DLL,然后您的问题很可能会消失


只需卸载windows“卸载程序”中标记为“(bundle)”的程序即可。

确保包含正确的nuget软件包(RC!),并在生成软件包的计算机上安装新的mvc4rc。

卸载屏幕中没有任何内容包含“(bundle)”唯一的mvc4条目是我今天安装的RC。从计算机上卸载了所有nuget软件包和mvc4,并重新安装了它们,然后它工作了。一定是剩下什么东西了。