2 回答
TA贡献1874条经验 获得超12个赞
试试将type改为:
type="System.Web.Mvc.IControllerFactory,System.Web.Mvc,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35"
TA贡献1858条经验 获得超8个赞
改成这样就可以了,昏,要写什么详细啊!不过还是要麻烦你下,现在
public class UnityControllerFactory : DefaultControllerFactory
{ private IUnityContainer _container;
public UnityControllerFactory()
{ _container = UnityContext.Current.Container;
}
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{ if (requestContext == null)
{ throw new ArgumentNullException("requestContext"); }
if (controllerType == null) {
throw new ArgumentNullException("controllerType");
}
IController controller = _container.Resolve(controllerType) as IController;
return controller;
}
}
- 2 回答
- 0 关注
- 710 浏览
添加回答
举报