I am registering a load of dependencies like so.
container.RegisterTypes(AllClasses.FromLoadedAssemblies(),
WithMappings.FromMatchingInterface,
WithName.Default,
overwriteExistingMappings: true);
This registers things fine and the web api endpoints are properly configured.
If I do iisreset
or simply wait for a bit then things fail with
The error message is not terribly helpful
"exceptionMessage": "An error occurred when trying to create a controller of type 'ApiController'. Make sure that the controller has a parameterless public constructor.",
Which of course the controller does not, and should not, have.
I am not sure what is going on... but if I register the dependencies explicitly
container.RegisterType<IDoAThing, Domain.Things.DoAThing>(new HierarchicalLifetimeManager());
Then it all works.
How can I get the 'by convention' registration to keep working?