Ran into an issue where certain routes defined on attributes fail. It seems to b only certain cases and I've documented them in the following StackOverflow question.
http://stackoverflow.com/questions/21871471/http-put-failing-on-iis-8-5
In essence the "root" route does not seem to work with a prefix. So in my specific example I can't have a prefix of api on the products controller and thus define a route as "api/products" and to a PUT to it. Only the "products" will work.
Comments: I created a dead simple message handler and it never get's hit.... public class MessageInspector : DelegatingHandler { protected override System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { var requestTest = request; if (requestTest.Method == HttpMethod.Put) { throw new Exception("STOP!"); } return base.SendAsync(request, cancellationToken); } } And wired it up... public static class WebApiConfig { /// <summary> /// The register. /// </summary> /// <param name="config"> /// The config. /// </param> public static void Register(HttpConfiguration config) { // Web API configuration and services config.MessageHandlers.Add(new MessageInspector()); // Web API routes config.MapHttpAttributeRoutes(); } } Stuck a break point in it and it never hits it...
http://stackoverflow.com/questions/21871471/http-put-failing-on-iis-8-5
In essence the "root" route does not seem to work with a prefix. So in my specific example I can't have a prefix of api on the products controller and thus define a route as "api/products" and to a PUT to it. Only the "products" will work.
Comments: I created a dead simple message handler and it never get's hit.... public class MessageInspector : DelegatingHandler { protected override System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { var requestTest = request; if (requestTest.Method == HttpMethod.Put) { throw new Exception("STOP!"); } return base.SendAsync(request, cancellationToken); } } And wired it up... public static class WebApiConfig { /// <summary> /// The register. /// </summary> /// <param name="config"> /// The config. /// </param> public static void Register(HttpConfiguration config) { // Web API configuration and services config.MessageHandlers.Add(new MessageInspector()); // Web API routes config.MapHttpAttributeRoutes(); } } Stuck a break point in it and it never hits it...