I'm trying to create a CustomerDefaultDirectRouteProvider
that extends DefaultDirectRouteProvider
in Web API 2.2, as in this example. However, when I implement the method GetActionRouteFactories(HttpActionDescriptor actionDescriptor)
, I get the error "no suitable method found to override".
I am able to override GetActionRouteFactories(ActionDescriptor actionDescriptor)
, but the ActionDescriptor
class does not have the method GetCustomAttributes<IDirectRouteFactory>
.
I am importing the following namespaces:
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Mvc.Routing;
using System.Web.Routing;
using System.Web.Http.Controllers;
Am I missing some, perhaps?
You are mixing MVC and WebAPI. Both have the
DefaultDirectRouteProvider
class. I suggest you remove the.Mvc
-namespaces and use the one fromSystem.Web.Http.Routing
.