I have an endpoint that I want to catch all POSTs regardless of what the url is.
Currently I have:
public class ProxyController : ApiController
{
[Route("{*url}")]
[HttpPost]
public async Task<HttpResponseMessage> Post()
{
.............
This works great for urls like 'http://localhost:64578/SomeRoute'
and the endpoint gets hit.
But as soon as I add an extension eg.
'http://localhost:64578/SomeRoute.svc'
The endpoint doesn't get hit.
It will however hit 'http://localhost:64578/SomeRoute.svc/'
but I really need the former.
My route setup looks like:
public static void Register(HttpConfiguration config)
{
var container = StructureMapIoC.GetStructureMapContainer();
ConfigStructureMapContainer(config, container);
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
Is anyone able to explain why and suggest how to fix?