Posts
203
Comments
1118
Trackbacks
51
May 2011 Entries
Resolve 404 in IIS Express for PUT and DELETE Verbs

IIS Express is a new web server that replaces the old Visual Studio web server (aka Cassini).  IIS Express provides a number of benefits which you can read about here and they key aspect is that it is IIS. However, that’s not to say that there aren’t any gotchas. One of the things that I ran into recently was that I was getting a 404 when trying to use the PUT and DELETE verbs (which are commonly used in RESTful services).  The reason this is happening is because these verbs are not enabled in the mappings for the handlers by default.

To enable this is the full version of IIS, it is a relatively straight forward task using the IIS Admin tool. First you go to the Handler Mappings:

handlerMappings

 

Then you select the “ExtensionlessUrlHandler-Integrated-4.0 handler:

handlerMappingsListView

 

Select “Request Restrictions”:

editManagedHandler

 

Then add PUT and DELETE on the “Verbs” tab:

requestRestrictions

 

Although the IIS Manager GUI makes this easy when using the full version of IIS, you don’t have the benefit of this GUI when working with IIS Express. But IIS Express *is* IIS so you can configure just about anything. The first thing you need to do is to find the IIS Express Configuration file. This is located in: C:\Users\<YourUserName>\Documents\IISExpress\config\applicationhost.config. Near the bottom of the file, you find the <handlers> section at this path: /configuration/location/system.webServer/handlers. Next, do a Find (Ctrl-F) for “ExtensionlessUrl-Integrated-4.0”. The final step is to add PUT and DELETE to the verb attribute:

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

At this point, you should be good to go!

UPDATE 8/14/2011: Some people have reported that they had to change their applicationhost.config file inside of the "C:\Program Files (x86)\IIS Express\config" directory (which does *not* match the documentation incidentally). The IIS team updated the documentation at the end of July (about 2 months after I originally posted this) here: http://learn.iis.net/page.aspx/901/iis-express-faq/ (just look for the section called "Q: How do I enable verbs like PUT/DELETE for my web application?").

Posted On Saturday, May 28, 2011 12:33 AM | Comments (12)
CMAP MVC3 Presentation–Code Samples

I had a great time presenting MVC 3 and the Web Platform at CMAP this week. Thanks to everyone who came out. The code samples and PowerPoint can be downloaded here.

Posted On Thursday, May 5, 2011 6:25 AM | Comments (1)
Upcoming CMAP Presentation–MVC 3 and the Web Platform

This Tuesday (May 3) I will be presenting MVC 3 and the Web Platform at CMAP. Details can be found here. Hope to see you there!

Posted On Sunday, May 1, 2011 10:33 PM | Comments (4)

View Steve Michelotti's profile on LinkedIn

profile for Steve Michelotti at Stack Overflow, Q&A for professional and enthusiast programmers




Google My Blog

Tag Cloud