我使用以下代码注册MVC控制器
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Classes.FromThisAssembly()
.BasedOn<IController>()
}
当我发布禁用“优化代码”的代码时,它可以正常工作。但是,如果我发布了“优化代码”,则获得以下异常。
No component for supporting the service Test.TestController was found
在下面标出的行上:
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
if (controllerType == null)
{
throw new HttpException(404, string.Format("The controller for path '{0}' could not be found.", requestContext.HttpContext.Request.Path));
}
return (IController)_kernel.Resolve(controllerType); //exception raised HERE
}