Rest not allowing PUT in IIS 8.5 : error 405

2019-08-08 08:23发布

问题:

I have a restfull web service in .Net. When we tested the PUT in a PC with windows 7 and IIS 7 it works fine.

When we tested the web service in a PC with windows 8 and IIS 8.5 we get a 405 status code. This is the result from Fiddler

Edit This is the applicationHost.config part regarding ExtensionlessUrlHandler-Integrated. I don't have an ExtensionlessUrl-Integrated

I assume this is a IIS issue, anyone knows how to solve this? Thanks in advance

回答1:

You have to add the PUT verb in your ExtensionlessUrl-Integrated-4.0 list. Make the following change your applicationhost.config file for your IIS instance.

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

You will also want to add any other verbs you might be allowing like DELETE.

See: ASP.NET Web API - PUT & DELETE Verbs Not Allowed - IIS 8