Thursday, February 19, 2015

ASP.NET Web Api 404 errors

I recently deployed a ASP.NET Web Api web service to a production server and kept getting 404 errors when I made requests.  After extensive research I finally traced the problem to the web.config file.  I don't totally understand why this fixed it, but it has something to do with how IIS resolves the URL.

In the web.config, you'll find this line:

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

This needs be changed to:

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

Notice the removal of the period from the "path" attribute.

No comments:

Post a Comment