Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Feature: some Message handlers not executed with attr routing [1177]

$
0
0
Some message handlers are not executed with attribute routing in WebHost if there’s not an existing route. (They’re always executed in SelfHost)
This is the general case of issue 954, and is related to Issue 1145 (404/405 handling).

Eg, suppose
config.MessageHandlers.Add(new MyHandler());
config.MapHttpAttributeRoutes();

And we have a controller:
// http://localhost:40054/api/v2/echo/test
[RoutePrefix("api/v2/echo")]
public class Echo2Controller : ApiController
{
[HttpGet("test")]
public string Get()
{
return "7";
}
}

GET http://localhost:40054/api/v2/echo/test
Will invoked the MyHandler message handler.

DELETE http://localhost:40054/api/v2/echo/test
Will get an immediate 404 and won’t invoke the handler.
This will execute if it's not attr-based routing. (And if the handler is empty, it will return 405)

This is likely due to attr routing being implemented with message constraints in the route table. The method constraint means now route claims the request, and so handlers are only run if a route claims it.

Comments: Verified

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>