Ninject error in WebAPI 2.1 - Make sure that the controller has a parameterless public constructor

后端 未结 10 2100
心在旅途
心在旅途 2020-12-31 00:39

I have the following packages and their dependencies installed in my WebAPI project:

Ninject.Web.WebApi Ninject.Web.WebApi.OwinHost

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 00:40

    I've got a situation where I have a service, and into it injected other services. One of these injected services had another injected services, and one of them was not registered properly for dependency injection.

    I set a breakpoint in the constructor of services that were injected in controller (services before one that was causing a problem). In debugging it was shown for which service it cannot resolve the dependency.

提交回复
热议问题