Enable PUT on WCF REST Api on IIS 6 (without .svc

2019-04-30 00:57发布

问题:

On IIS 6 how can I allow the PUT operation on a WCF Rest API?

Since I don't have the .svc file (I added a route on global.asax to service class) I can't allow the put operation on the .svc extension on IIS 6.

回答1:

  • Open the IIS Management console,
  • Right click on your website in the sidebar and go to properties.
  • Go to the "Home Directory" Tab
  • Click on the "configuration" button
  • Add a wildcard mapoping to your isapi.dll (you can copy and paste from the top window). Uncheck the "verify file exists" checkbox

Other solution suggest changing the verbs for a given extension, but if you don't have one thne this wildcard thing works.

There may be a better way of course but it works for us



回答2:

PUT verb for us would not work when calling the API via CURL for testing yet other verbs were ok.

  • REST API
  • Windows 2003 Server x64 standard edition
  • IIS6
  • .net 4.0 framework

For us the solution was:

  • open MMC and connect to IIS6
  • right click website and properties
  • select home directory
  • configuration
  • select the file extension you are using
  • EDIT
  • Either "allow all verbs" or add "PUT" to the "Limit to" list.
  • Apply

Hope that helps someone.

(please note i tried the WILDCARD suggestion below but did not resolve our issue)



标签: wcf http iis rest