This is a quick troubleshooting post in case anyone bumps into Structuremap issues with Find. On a recent project, when we tried to load the Find UI the website crashed with this exception:
An error has occurred.","ExceptionMessage":"An error occurred when trying to create a controller of type 'EditorialBoostingController'. Make sure that the controller has a parameterless public constructor
I've used Find on a couple of projects now and usually, out the box, it works with structure map with no qualms... However, this time we got the dreaded 'parameterless error'. If you get this, it means that structure map has got its knickers in a twist and it doesn't know how to resolve something. In this case, it's the IClient parameter. Jonas Bergqvist pointed me in a useful direction. If you find yourself in a similar situation, then in your structure map set-up code (which I'm assuming is in an initialization module). You can manually create a concrete instance of the client like so:
context.Services.AddSingleton(x => SearchClient.Instance);
Hopefully, this might help save someone a few hours, enjoy!
Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge