405 Bad request error while inserting – updating ADO.NET Data Service
A few weeks ago I started working on a project which involved a ADO.NET Data Service. This is a way of bringing your datalayer online and letting clients query and update entities in your datalayer (database) through RESTful webservices.
Locally everything was working fine, I tested the entire project and after fixing most bugs I was ready to deploy the service to the production server online. That machine is a windows 2008 server with IIS7 on it, so it does have some differences to my local XP / IIS5.1 environment. After deploying I went of testing again and found out that only the retrieval bits were working; inserting and updating produced errors. After enabling verbose errors on my service I found out that the server was returning a 405 bad request error.
To cut a long story of searching and debugging short: the WebDAV module which was also installed on the server was causing these 405 errors! Even though WebDAV wasn’t enabled on the particular site, it still messed up the PUT and MERGE calls from the ADO.NET Data Service. Disabling the module and removing the http handler (for the site hosting the services only) fixed the problem!