为什么WindsorDependencyResolver无法解决?

B. *_*non 2 c# dependency-injection castle-windsor inversion-of-control visual-studio-2013

我通过NuGet将Castle Windsor安装到我的Web API项目中(VS 2013; Castle 3.2.1).

我添加了这段代码:

var container = new WindsorContainer();
GlobalConfiguration.Configuration.DependencyResolver = new WindsorDependencyResolver(container);
Run Code Online (Sandbox Code Playgroud)

...从这里到Global.asax.cs的Application_Start方法.

然而,虽然我在我的引用中有Castle.Core和Castle.Windsor,但WindsorDependencyResolver是无法解析的(解析器没有得到解决是多么讽刺).

我该如何解决这个问题?

Pat*_*ele 5

WindsorDependencyResolver不是Castle Windsor附带的课程.这是您引用的原始帖子的作者写的自定义类.他的页面有一个指向他的GitHub项目的链接,该项目包含博客文章的源代码 - 包括WindsorDependencyResolver.