I'd like to log the requests to my Web API application that results in 404 (which means the routing engine couldn't find a matching service).
How would that be possible?
For example, if I have the below mapping:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new
{
id = RouteParameter.Optional
}
);
then calling the below will return 404:
api_rootNotValid/controllername
I want to capture such requests and log them.
I've created a class inheriting from DelegatingHandler but only when the routing engine succeeds finding a service then it goes into the DelegatingHandler.
So I think there should be something else that can help?