I have ASP.NET Mvc application and I integrated Ninject as I installed this nuget package which updated my code. I added a NinjectWebCommon class to the App_Start folder of my solution. What I did was to register some of my interfaces and their implementations:
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<ITokenManager>().To<TokenManager>();
}
The problem is that when I try to resolve an instance of this interface:
var kernel = new StandardKernel();
kernel.Load(Assembly.GetExecutingAssembly());
var tokenManager = kernel.Get<ITokenManager>();
I get an error. What it says is:
Error activating ITokenManager No matching bindings are available, and the type is not self-bindable. Activation path: 1) Request for ITokenManager
Suggestions: 1) Ensure that you have defined a binding for ITokenManager. 2) If the binding was defined in a module, ensure that the module has been loaded into the kernel. 3) Ensure you have not accidentally created more than one kernel. 4) If you are using constructor arguments, ensure that the parameter name matches the constructors parameter name. 5) If you are using automatic module loading, ensure the search path and filters are correct.
I don't really understand it as all of the tutorials explain the configuration in the exact same way as I did it.
What could be the reason?