Error "More than one matching bindings are available" when using Ninject.Web.Mvc 2.0 and ASP.NET MVC

Posted by Cray on Stack Overflow See other posts from Stack Overflow or by Cray
Published on 2010-03-11T09:34:52Z Indexed on 2010/03/12 9:47 UTC
Read the original article Hit count: 568

Filed under:
|
|
|

Hello all,

Recently I've switched to Ninject 2.0 release and started getting the following error:

Error occured: Error activating SomeController
More than one matching bindings are available.
Activation path:
  1) Request for SomeController

Suggestions:
  1) Ensure that you have defined a binding for SomeController only once.

However, I'm unable to find certain reproduction path. Sometimes it occurs, sometimes it does not. I'm using NinjectHttpApplication for automatic controllers injection. Controllers are defined in separate assembly:

public class App : NinjectHttpApplication
{
    protected override IKernel CreateKernel()
    {
        INinjectModule[] modules = new INinjectModule[] {
            new MiscModule(),
            new ProvidersModule(),
            new RepositoryModule(),
            new ServiceModule()
        };

        return new StandardKernel(modules);
    }

    protected override void OnApplicationStarted()
    {
        RegisterRoutes(RouteTable.Routes);
        RegisterAllControllersIn("Sample.Mvc");
        base.OnApplicationStarted();
    }

    /* ............. */

}

Maybe someone is familiar with this error.

Any advice?

© Stack Overflow or respective owner

Related posts about ninject

Related posts about ASP.NET