Я пытаюсь получить следующие URL
v1/$metadata
v1/se/companies
v1/se/addresses
v1/no/companies
v1/no/addresses
Но если я использую [ODataRoutePrefix("se/Companies")]
, я получаю следующую ошибку
System.InvalidOperationException: The path template 'se/Companies({companyNumber})' on the action 'Get' in controller 'SwedishCompany' is not a valid OData path template. Resource not found for the segment 'se'.
at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.GetODataPathTemplate(String prefix, String pathTemplate, IServiceProvider requestContainer, String controllerName, String actionName)
at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.<>c__DisplayClass11_0.<GetODataPathTemplates>b__1(ODataRouteAttribute route)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.BuildAttributeMappings(IEnumerable`1 controllerActions)
at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.get_AttributeMappings()
at Microsoft.AspNet.OData.Routing.Conventions.AttributeRoutingConvention.SelectAction(RouteContext routeContext)
at Microsoft.AspNet.OData.Routing.ODataActionSelector.SelectCandidates(RouteContext context)
at Microsoft.AspNetCore.Mvc.Internal.MvcRouteHandler.RouteAsync(RouteContext context)
at Microsoft.AspNetCore.Routing.Route.OnRouteMatched(RouteContext context)
at Microsoft.AspNetCore.Routing.RouteBase.RouteAsync(RouteContext context)
at Microsoft.AspNetCore.Routing.RouteCollection.RouteAsync(RouteContext context)
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
Есть ли способ добавить префикс с /
?