Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
What is the best practice way of calling MapMvcAttributeRoutes in an Umbraco 8 application? In umbraco 7 I called it from an ApplicationEventHandler method (ApplicationStarted) but that's replaced with Composers/Components in umb8 I believe. I created a component but now get an error about a missing service for my custom route?
thanks for the help
Could you provide some code and what error you're getting?
Or you could create a starting class which inherits from UmbracoDefaultOwinStartup, if all else fails.
thanks Sibren. The exception is
Unable to resolve type: MyWebsite.WidgetsController, service name:
where the controller is
public class WidgetsController : Controller
public ActionResult Show()
and the view has
Yes using Owin could be one option. Essentially I just want to register (the non umbraco) mvc routes in my application, so figured i need to call MapMvcAttributeRoutes somehow?
The Umbraco component is:
public class RegisterCustomRouteComponent : IComponent
public void Initialize()
public void Terminate()
throw new NotImplementedException();
update: following another thread i found, i made my controller inherit from RenderMvcController so that umbraco "knows" about the controller/"service".
Did this work?
Because RouteTable.Routes.MapMvcAttributeRoutes(); does not what you're describing here.
It does map the routes you're using in your controller though.
I am reading up on https://our.umbraco.com/documentation/reference/routing/custom-routes where it states you need to do some other stuff.
Did you read that? I am trying the same thing but with an API, but am also struggling.
I'll keep you informed!
Hi - yes it worked.
So at this point I have a Component that calls "RouteTable.Routes.MapMvcAttributeRoutes();" and also a custom controller that inherits from RenderMvcController.
This was the only way i could register the routes for my custom controller methods even though the methods aren't concerning umbraco content. I figure it makes sense that this is how an "UmbracoApplication" would know about all of the registered routes (umbraco or not). Ideally i wouldn't need to use RenderMvcController if there was some other/simpler way
basically, my original question was how do i get an UmbracoApplication to honour the stock standard mvc route attribute on my custom controller method:
public ActionResult MyMethod()
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted