I have ported my Web Api application to Web Api 2 and installed ninject web api pacckage. But now I am getting an error:
Error activating ModelValidatorProvider using binding from ModelValidatorProvider to NinjectDefaultModelValidatorProvider
A cyclical dependency was detected between the constructors of two services.
I had this same issue. I got it when I added Ninject.Web.WebApi as a Nuget package.
To resolve the issue, I had to remove a workaround that I had previously implemented.
In the previous workaround, I had set the dependency resolver in NinjectWebCommon to a custom class that implemented IDependencyResolver.
In short, if you have a line similar to GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel);
in NinjectWebCommon's CreateKernel()
, remove it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With