Injecting EPI IBlobFactory in service class using StructureMap?


Hi, I have a .NET WebApi 2 controller class in my Episerver solution, that requires an (injected) service class, which I register via the prescribed EPI server StructureMap configuration.

This service class takes a constructor dependency on IBlobFactory, which - I suppose??? - gets added to the StructureMap container by EPI, or it will look it up when needed via EPI ServiceLocator or something?

Now I keep getting the exception: "Controller XXX does not have a parameterless constructor", when invoking the controller API method.

I did get it to work using a paramerless constructor and using Epi ServiceLocator to get the service, but that is not what I want...

It seems Structuremap does not inject dependencies in WebAPI controllers???

Any ideas on how to troubleshoot this issue are welcome...

Edited, Feb 07, 2018 8:26

I found the problem, see or

Since this is about DI in an API controller, we need a bit of additional setup to make this work, see links.

Feb 07, 2018 17:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.