I run into 500 - Internal Server Error when PUT/DELETE
with windows 2008 server IIS. The response I get is:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>500 - Internal server error.</title>
<style type="text/css">
<!--
Formatting
-->
</style>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
<div class="content-container"><fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
</fieldset></div>
</div>
</body>
</html>
When I check my custom logs of my WebAPI I find that the call has not even hit the service.
My earlier experience was getting 404 - Not Found for PUT
and DELETE
and this behavior was consistent across Win7 and Win 2008 Server. For that I found this fix:
I applied the fix and PUT/DELETE
works on windows 7. But after that when deployed the same service on IIS 7 in win2008 server I do not get 400. But I get "500 - Internal Server Error" from IIS or something even before that.
The same code works perfectly on windows 7 (IIS 7.5).
Any clues on resolution of such issues?
Edited Aug 29, 2012:
The issue of 500-Internal Server Error is detected by enabling fault-tracing in IIS7. The fix is this configuration.
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
Basically we need to remove "WebDAVModule" from modules and also remove "WebDAV" from Handlers. But now I am back to my old issue of 404-Not Found. Now even after having the below configuration i cannot get PUT/DELETE to work:
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
Unusually the same web application works perfectly on hosted separately (not under default web site) on the same system same IIS. So I suspect this is due to some parent website configuration which filters PUT/DELETE requests.
Any ideas on the same?