ASP.NET Web API returns 404 for PUT only on some servers


I have written a site that uses ASP.NET MVC Web API and everything is working nicely until I put it on the staging server. The site works fine on my local machine and on the dev web server. Both dev and staging servers are Windows Server 2008 R2.

The problem is this: basically the site works, but there are some API calls that use the HTTP PUT method. These fail on staging returning a 404, but work fine elsewhere.

The first problem that I came across and fixed was in Request Filtering. But still getting the 404.

I have turned on tracing in IIS and get the following problem.

ModuleName IIS Web Core 
Notification 16 
HttpStatus 404 
HttpReason Not Found 
HttpSubStatus 0 
ErrorCode 2147942402 
ErrorCode The system cannot find the file specified. (0x80070002) 

The configs are the same on dev and staging, matter of fact the whole site is a direct copy.

Why would the GETs and POSTs work, but not the PUTs?

asked on Stack Overflow Apr 11, 2012 by Greg Bacchus • edited Jan 16, 2019 by Marcos Dimitrio

9 Answers


For those of you who do not have WebDAV enabled but are still running into this issue using MVC 4's Web API's...

Steve Michelotti documented a solution that worked for me here.

At the end of the day, I enabled all verbs (verb="*") to the ExtensionlessUrlHandler-Integrated-4.0 handler in my web config.

    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
            <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" />
answered on Stack Overflow Apr 19, 2012 by Kevin Ortman

Those IIS servers have web-dav module installed on them and i bet it is not needed and it was installed because the person installing ticked all boxes.

Just remove web-dav from iis.

Alternatively use web.config to remove web dav module:

        <remove name="WebDAVModule" />
answered on Stack Overflow Apr 11, 2012 by Aliostad • edited Apr 11, 2012 by Aliostad

It seems there are a number of reasons that this occurs. None of the above quite worked for me. I already had the ExtensionlessUrlHandler settings in web.config with all the required HTTP verbs. In the end I had to make the following changes in IIS:

  • In IIS select your website and double-click Handler Mappings
  • Find ExtensionlessUrlHandler-ISAPI-4.0_32bit and double-click
  • In the dialog that appears, click Request Restrictions
  • On the Verbs tab add the missing HTTP verbs separated by commas (in my case it was PUT and DELETE
  • Click Ok where required and answer Yes in the Edit Script Map dialog that pops up.
  • Repeat for ExtensionlessUrlHandler-ISAPI-4.0_64bit

Hope this helps somebody :)

answered on Stack Overflow Nov 15, 2016 by wingyip

My hosting provider could NOT uninstall WebDAV as this would affect everyone.

This, runAllManagedModulesForAllRequests="true" , worked but was not recommended.

Many fixes included removing the module for WebDAVModule but that still didn't work. I removed the handler also, and finally I could use all verbs POST GET PUT DELETE.

Remove WebDAVModule and WebDAV in modules and handlers.

    <remove name="WebDAVModule" />
    <remove name="WebDAV" />
answered on Stack Overflow Nov 27, 2012 by Stanomatic

I fixed this removing the UrlScan ISAPI filter

answered on Stack Overflow May 19, 2015 by pomber

In my case, none of these solutions applied.

I fixed it by changing my app pool to Integrated instead of Classic.

The handler:

<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

is not going to work with a Classic app pool, since its preCondition is integratedMode.

answered on Stack Overflow Jul 27, 2015 by toddmo

Rick Strahl from West-Wind recommended the following:

    < handlers>
    < remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
    < add name="ExtensionlessUrlHandler-Integrated-4.0"
    < /handlers>
Which Worked very well for me.

answered on Stack Overflow Apr 15, 2014 by RickIsWright • edited Apr 15, 2014 by RickIsWright

Hi For me none of the solutions worked. I finally got it working doing this :

1) In IIS select you application.
2) Go to Request Filtering
3) Then select the HTTP Verbs tab
4) I found the PUT and other verbs to have allowed to false but wasn't able to just edit so I removed the verb then either in the pane on the right select allow verb or right click on the list and select it. Enter the verb you're having troubles with and voilĂ  !

Hope this will help someone !

answered on Stack Overflow Aug 31, 2018 by user2736265

I resolved this by changing my application pool for the website to Integrated mode when it was previously on Classic mode.

answered on Stack Overflow Jul 11, 2014 by James Hay

User contributions licensed under CC BY-SA 3.0