MVC2 to MVC3 IOC problem
I just migrated from MVC2 to MVC3 and I got the following error when I build the project :
RhinoIoCControllerFactory does not implement interface member System.Web.Mvc.IControllerFactory.GetControllerSessionBehavior(System.WebRouting.RequestContext,string)
Here is rhe class where the error come from :
public class RhinoIoCControllerFactory : IControllerFactory
{
public IController CreateController(RequestContext requestContext, string controllerName)
{
return IoC.Resolve<IController>((controllerName + "Controller").ToLower());
}
pu开发者_Go百科blic void ReleaseController(IController controller)
{
IoC.Container.Release(controller);
}
}
Any ideas ?
Thanks
You need to implement the MVC3 method. The following will fix it:
public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName)
{
return SessionStateBehavior.Default;
}
http://blog.janjonas.net/2011-05-30/aspnet-mvc-fix-icontrollerfactory-implementation-upgrading-mvc_2-mvc_3
精彩评论