开发者

"Does not implement IControllerFactory.CreateController" in Visual Studio 2010

开发者 https://www.devze.com 2022-12-26 02:51 出处:网络
When compiling this code: public class WindsorControllerFactory : IControllerFactory { private readonly WindsorContainer _container;

When compiling this code:

public class WindsorControllerFactory : IControllerFactory
{
    private readonly WindsorContainer _container;

    public WindsorControllerFactory(WindsorContainer container)
    {
        _container = container;
    }

    public IController Crea开发者_JS百科teController(RequestContext requestContext,
                                        string controllerName)
    {
        return (IController)_container.Resolve(controllerName);
    }

    public void ReleaseController(IController controller)
    {
        _container.Release(controller);
    }
}

I am getting this error:

'WindsorControllerFactory' does not implement interface member 'System.Web.Mvc.IControllerFactory.CreateController(System.Web.Routing.RequestContext, string)'

Well, it obviously implements this member. Has anyone encountered this problem?

I reproduced this on the RTM, opened a ticket with Microsoft.


Error went away after I added reference to System.Web.Routing 4.0.0.0. Before this it was indirectly referenced to 3.5.0.0 version (through System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

Thus i have the following references:
System.Web.Mvc 2.0.0.0 (v2.0.50727)
System.Web.Routing 4.0.0.0 (v4.0.30128)


you might have two conflicting versions of System.Web.routing or something like that.


There is also a RequestContext class in the System.ServiceModel.Channels namespace; included in the System.ServiceModel.dll assembly.

Hover over the RequestContext argument type of your your method and check that it pointing to the correct one.

More information here


Include a reference to System.Web (v4.0.30319).

0

精彩评论

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