views:

319

answers:

4

When compiling this code:

public class WindsorControllerFactory : IControllerFactory
{
    private readonly WindsorContainer _container;

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

    public IController CreateController(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.

A: 

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

Ken Egozi
How can I check this?
ripper234
did you install multiple Betas or RCs? do you have some suspicious stuff in the bin folder? did you try compiling it with csc.exe?btw - look at the output window of VS to see its generated csc.exe call?
Ken Egozi
I had beta 2 previously, then fully uninstalled it then and installed RC. I'll try see what csc.exe says.
ripper234
No luck, same error from csc.exe.
ripper234
A: 

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

Thomas
I wrote the explicit class name, it didn't help :(
ripper234
And did you write System.Web.Routing.RequestContext or System.ServiceModel.Channels.RequestContext? You should have the first.
Thomas
I'll double check tomorrow.
ripper234
I wrote System.Web.Routing.RequestContext and it didn't work. It's just an insolvable bug in Visual Studio I guess. I'll upgrade to the RTM and see if it solves it.
ripper234
A: 

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)

Kent3200
I will give your suggestion a try.
ripper234
Doesn't work, sorry.
ripper234
A: 

This was resolved when I upgraded to the RTM.

ripper234
I would delete this answer as it's premature. This does NOT work.
ripper234