I'm struggling to figure this out - I have an OData V4 service which I have developed using .Net ODataConventionModelBuilder. Everything works fine when running "within visual studio" (i.e. localhost:port/service) but when I publish the service to IIS I can no longer make batch requests.
Example1 : Running under IISExpress while visual studio is running
GET http://localhost:1234/service/SomeResource - works fine to access a resource and return JSON response
POST http://localhost:1234/service/$batch - works fine to send a batch request (obviously with body data) for multiple GETs
Example2 : Hosting under IIS
GET http://localhost/service/SomeResource - works fine to access a resource and return JSON response
POST http://localhost/service/$batch - fails with a HTTP 404 Not Found "Message": "No HTTP resource was found that matches the request URI 'http://localhost/service/$batch'.", "MessageDetail": "No route providing a controller name was found to match request URI 'http://localhost/service/$batch'"
so I'm stuck I dont understand why routing is working ok when running under studio/IISExpress and not under proper IIS.
Ok seems this was down to a problem interpreting the url because of the $batch part.
Adding this to web.config solved it ok.
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>