3

I am currently using serviceStack for creating REST based services which are hosted in a MVC web application.

So far ServiceStack has been amazing and I have achieved to get most of what I wanted to do working. All this works in IISExpress.

I have now moved over to IIS 7.5 and I get the 400 error that the "Handler for Request not found" when doing a PUT. GET works fine and on IISExpress both PUT and GET work.

On IISExpress this all worked.

Any ideas?

skaffman
  • 398,947
  • 96
  • 818
  • 769
JD.
  • 15,171
  • 21
  • 86
  • 159

1 Answers1

9

Some info about IIS + PUT/DELETE Verbs taken from the NancyFx WebFx ASP.NET documentation:

By default IIS 6 does not support PUT and DELETE verbs. To enable this, you need to add a wildcard mapping to the virtual directory of your Nancy application - read the "IIS6 Extension-less URLs" section in this document: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

You might receive "405 Not allowed" pages while trying to make PUT/DELETE requests on IIS 7/7.5. One way to fix it is to remove the WebDAVModule in the web.config.

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
    </modules>  
</system.webserver>

Soft PUT / DELETE - Emulating HTTP Verbs

ServiceStack also supports the X-Http-Method-Override HTTP Header which will allow you to simulate a PUT or DELETE with a POST (and vice-versa).

mythz
  • 141,670
  • 29
  • 246
  • 390
  • Thanks. i already have the remove WebDavModule. Should I try the X-http-method-override? My client is a flex client so I am wondering if that is the issue? – JD. Apr 23 '12 at 15:39
  • Tried X-Http-Method-Override and PUT does not work. I tried POST and that does not work either, although from Fiddler both POST and PUT work. I keep getting "Handler for request not found" (404 not found) from my flex client library. Any clues where to look now? – JD. Apr 23 '12 at 16:08
  • I am not using NancyFx (didn't know what it was until a few mins ago :)) – JD. Apr 23 '12 at 16:10
  • It sounds like the flex client is sending a different HTTP Request than what you expect. I would look at packet sniffing the HTTP request (w/ something like Fiddler or WireShark) so you can identify the difference. Could also be CORS related http://stackoverflow.com/questions/8211930/servicestack-rest-api-and-cors – mythz Apr 23 '12 at 16:11
  • Yes, the flex client was sending all sorts of crap but it is now working. Thank you for all your help. Once again, amazing product. – JD. Apr 24 '12 at 10:43