简体   繁体   中英

Rest not allowing PUT in IIS 8.5 : error 405

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

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

It mainly happens due to WebDAV installation to IIS Server.

Just add the following XML block in your web.config file

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM