Asp.net Mvc中MVCContrib中无法使用Castle的发解决方案

在使用Asp.net Mvc MVCContrib 0.0.1.91中的Castle时会出现No component for key Home was found这样的错误

错误解决方法如下:

下载MvcContrib源代码,更改MvcContrib.Castle的WindsorControllerFactory.cs中的34行CreateController方法为:

 

            public IController CreateController(RequestContext context, string controllerName)
            {
                        controllerName = controllerName + "Controller"; //更改了这里

                    IWindsorContainer container = GetContainer(context);
                    return (IController)container.Resolve(controllerName);
            }

这个更改方法可能仅限于MVCContrib 0.0.1.91

你可能感兴趣的:(Asp.net Mvc中MVCContrib中无法使用Castle的发解决方案)