Ninject.Web.WebApi icon indicating copy to clipboard operation
Ninject.Web.WebApi copied to clipboard

Error in ModelValidatorProvider

Open jormenjanssen opened this issue 10 years ago • 3 comments

When i used NuGet to upgrade the following message did appear when using Web API 2.1 and MVC5

Error activating ModelValidatorProvider using binding from ModelValidatorProvider to NinjectDefaultModelValidatorProvider A cyclical dependency was detected between the constructors of two services.

Activation path: 3) Injection of dependency ModelValidatorProvider into parameter defaultModelValidatorProviders of constructor of type DefaultModelValidatorProviders 2) Injection of dependency DefaultModelValidatorProviders into parameter defaultModelValidatorProviders of constructor of type NinjectDefaultModelValidatorProvider

  1. Request for ModelValidatorProvider

jormenjanssen avatar Apr 29 '14 18:04 jormenjanssen

I had the same problem when I upgraded my packages with NuGet yesterday.

jinyinmao avatar May 09 '14 02:05 jinyinmao

I resolved the issue by replacing the dll libaries manual with a version that worked. I Included a link for a version that works for me https://mega.co.nz/#!McBkDSYR!KTrY9rIOEMt0Ny_1xQqRTgPjrCvINg2sirjYjh8wOd0

jormenjanssen avatar May 09 '14 11:05 jormenjanssen

I am also having this issue when I did a fresh install this morning:

Server Error in '/' Application.

Error activating ModelValidatorProvider using binding from ModelValidatorProvider to NinjectDefaultModelValidatorProvider A cyclical dependency was detected between the constructors of two services.

Activation path: 3) Injection of dependency ModelValidatorProvider into parameter defaultModelValidatorProviders of constructor of type DefaultModelValidatorProviders 2) Injection of dependency DefaultModelValidatorProviders into parameter defaultModelValidatorProviders of constructor of type NinjectDefaultModelValidatorProvider

  1. Request for ModelValidatorProvider

Suggestions:

  1. Ensure that you have not declared a dependency for ModelValidatorProvider on any implementations of the service.
  2. Consider combining the services into a single one to remove the cycle.
  3. Use property injection instead of constructor injection, and implement IInitializable if you need initialization logic to be run after property values have been injected.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Ninject.ActivationException: Error activating ModelValidatorProvider using binding from ModelValidatorProvider to NinjectDefaultModelValidatorProvider A cyclical dependency was detected between the constructors of two services.

Activation path: 3) Injection of dependency ModelValidatorProvider into parameter defaultModelValidatorProviders of constructor of type DefaultModelValidatorProviders 2) Injection of dependency DefaultModelValidatorProviders into parameter defaultModelValidatorProviders of constructor of type NinjectDefaultModelValidatorProvider

  1. Request for ModelValidatorProvider

Suggestions:

  1. Ensure that you have not declared a dependency for ModelValidatorProvider on any implementations of the service.
  2. Consider combining the services into a single one to remove the cycle.
  3. Use property injection instead of constructor injection, and implement IInitializable if you need initialization logic to be run after property values have been injected.

sgmeyer avatar Jul 03 '14 13:07 sgmeyer