OData Action Gets 404 Due To Periods In URL
Following the tutorial at:
I encountered 404 errors until I noticed the tutorial says to change the web.config file. My original web.config contained:
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
while the tutorial says to change the path property to "/*" like this:
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="/*" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
It worked but then accessing a static file like default.htm caused an internal server error. One of the tutorial's comments suggested using:
<add name="ApiURIs-ISAPI-Integrated-4.0" path="/odata/*" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
where the path of "/odata/*" is based on what you specified as the routePrefix argument of the config.MapODataServiceRoute() call. The verb could probably be "*" if you like.
There is more info here:
https://stackoverflow.com/questions/11728846/dots-in-url-causes-404-with-asp-net-mvc-and-iis
Anyhow, as the commenter of the tutorial suggested, limiting the path worked for me and life is good.
Comments
- Anonymous
November 25, 2016
Thanks! Work for me!