So I have an AngularJs/MVC project with normal Controllers and decided to move more to an SPA app and add WebApi2 to pass data back to my UI instead of using MVC.
In my Global.asax I had the following for my MVC project:
DependencyResolver.SetResolver(new StructureMapDependencyResolver(container));
My WebApiController has a constructor with an IRepository to talk to the database and get some entities back. When my AngularJS web app makes a call to the controller the break points never hit and I'm getting server 500 errors returned with very little information.
Public class MyController : ApiController
{
public MyController (IThingRepository thingrepository)
{
....
}
}
I started seeing errors like:
"ExceptionType": "System.ArgumentException", "Message": "Type 'MyProject.Web.Controllers.MyController' does not have a default constructor"
I don't want to add a default constructor. Why am I getting this and how do I fix it?