Error: Make sure that the controller has a parameterless public constructor (Autofac, WebApi2, & Onion Architecture)
问题 OK, I am getting the familiar error: An error occurred when trying to create a controller of type 'UserController'. Make sure that the controller has a parameterless public constructor. ---> System.ArgumentException: Type 'Project.WebApi.Controllers.UserController' does not have a default constructor at System.Linq.Expressions.Expression.New(Type type) I am building a WebApi2 project (no MVC front end) that use Onion Architecture, putting most of my start-up code in App_Start of a Bootstrap