Unity.WebApi | Make sure that the controller has a parameterless public constructor

前端 未结 6 509
独厮守ぢ
独厮守ぢ 2020-12-19 10:48

I am using the Unity.WebApi NuGet package (Unity 4.0.1 and Unity.WebApi 5.2.3) in an ASP.NET WebApi solution. The issue I am facing is that when attempting to run the code,

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 11:41

    Unfortunately none of these answers worked for me. I had already used the method offered by smoksnes by following the steps described here: https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/dependency-injection

    My issue was fixed by using the web api specific unity package (Unity.AspNet.WebApi) rather than the general .net package as described on the Microsoft guide.

提交回复
热议问题