ASP.NET Web API extending DefaultDirectRouteProvider

I am trying to create CustomerDefaultDirectRouteProvider

one that extends DefaultDirectRouteProvider

in Web API 2.2 like in this example . However, when I implement the method GetActionRouteFactories(HttpActionDescriptor actionDescriptor)

, I get the error "No matching method found to override".

I can override GetActionRouteFactories(ActionDescriptor actionDescriptor)

, but the class ActionDescriptor

has no 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;

      

I missed some, maybe?

+3


source to share


1 answer


You are mixing MVC and WebAPI. Both have a class DefaultDirectRouteProvider

. I suggest you remove the .Mvc

-namespaces and use one of the System.Web.Http.Routing

.



+2


source







All Articles