Archive

Posts Tagged ‘404’

“Method Not Found” in ASP.NET Web API when using PUT and DELETE Verbs

Now that you have deployed your REST API and you are receiving “Method Not Found” exception / 404 exceptions when using PUT and DELETE verbs, while GET and POST is working absolutely fine. The fix is simple and needs small changes within IIS.

Open “Internet Information Services (IIS) Manager”, select the corresponding application and double-click on the “Handler Mappings” as shown below:

Image

Then select the “ExtensionlessUrlHandler-Integrated-4.0″ handler and double-click to edit this managed handler and click on “Request Restrictions…” button, as highlighted below:

Image

In the “Verbs” tab, select “One of the following verbs:” option and type-in the following verbs, “GET, HEAD, POST, DEBUG, PUT, DELETE”. Note: By default the “All verbs” option is selected by default.

Image

One final step is to ensure that your “web.config” contains “PUT” and “DELETE” in the verb attribute for “ExtensionlessUrl-Integrated-4.0” under the <handlers> section within <system.webServer>. Do a Find (Ctrl + F) if you have a really huge entries in “web.config” file.

<system.webServer>
  <handlers>
    <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>

You are good to go! As a practice I always perform a “Restart”, under “Manage Web Site” within the “Internet Information Services (IIS) Manager” window.

Categories: ASP.NET, C# Tags: , , , , , , ,
%d bloggers like this: