开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜