I am experiencing a situation where I have custom UmbracoApiControllers and in order to be able to inject Services as dependency injection, (I am using SimpleInjectorMVC) I have installed extension methods that basically register WebAPI Controllers
container.RegisterWebApiControllers(configration, assemblies);
container.RegisterMvcIntegratedFilterProvider();
container.Verify();
DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
configration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
My custom UmbracoAPIControllers are working fine when accessing them from my Frontend App (Angular 2) but when trying to access the umbraco CMS login, it does not allow me and throws an error, as seen below:
When I remove those two lines where I am registering WebApiControllers, everything works fine, except that I cannot inject services in my Api controllers.
Does anyone has an idea what I can do to solve this issue please?
<Error>
<Message>
No HTTP resource was found that matches the request URI 'http://localhost:12646/umbraco/backoffice/UmbracoApi/Authentication/PostLogin'.
</Message>
<MessageDetail>
No type was found that matches the controller named 'Authentication'.
</MessageDetail>
</Error>
Simple Injector Framework - Registering WebApiControllers conflicting with CMS Apis (not working)
Hi Guys,
I am experiencing a situation where I have custom UmbracoApiControllers and in order to be able to inject Services as dependency injection, (I am using SimpleInjectorMVC) I have installed extension methods that basically register WebAPI Controllers
container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
My custom UmbracoAPIControllers are working fine when accessing them from my Frontend App (Angular 2) but when trying to access the umbraco CMS login, it does not allow me and throws an error, as seen below:
When I remove those two lines where I am registering WebApiControllers, everything works fine, except that I cannot inject services in my Api controllers.
Does anyone has an idea what I can do to solve this issue please?
Thank you
Kind Regards
Error:
In my Global.asax,
I have this:
How can I define not to initialize SimpleInjectorMVC for Umbraco CMS api controllers>?
Appreciate any help.
thank you.
Hi Simon,
Did you find a solution to this scenario?
Thanks, Dan.
Has anyone solved this? I'm currently trying to integrate simpleinjector with my application and running into the same issue.
This seemed to work for me
https://github.com/simpleinjector/SimpleInjector/issues/258
Looks like I solved it :-) Using this:
container.RegisterWebApiControllers(GlobalConfiguration.Configuration);
Instead of:
container.RegisterWebApiControllers(GlobalConfiguration.Configuration, Assembly.GetExecutingAssembly());
is working on a reply...