简体   繁体   English

休息不允许在 IIS 8.5 中放置:错误 405

[英]Rest not allowing PUT in IIS 8.5 : error 405

I have a restfull web service in .Net.我在.Net 中有一个restfull web 服务。 When we tested the PUT in a PC with windows 7 and IIS 7 it works fine.当我们在装有 Windows 7 和 IIS 7 的 PC 中测试 PUT 时,它运行良好。

When we tested the web service in a PC with windows 8 and IIS 8.5 we get a 405 status code.当我们在装有 Windows 8 和 IIS 8.5 的 PC 中测试 Web 服务时,我们得到了 405 状态代码。 This is the result from Fiddler这是 Fiddler 的结果

在此处输入图片说明

Edit This is the applicationHost.config part regarding ExtensionlessUrlHandler-Integrated .编辑这是有关ExtensionlessUrlHandler-Integrated的 applicationHost.config 部分。 I don't have an ExtensionlessUrl-Integrated我没有 ExtensionlessUrl-Integrated

在此处输入图片说明

I assume this is a IIS issue, anyone knows how to solve this?我认为这是一个 IIS 问题,有人知道如何解决这个问题吗? Thanks in advance提前致谢

You have to add the PUT verb in your ExtensionlessUrl-Integrated-4.0 list.您必须在 ExtensionlessUrl-Integrated-4.0 列表中添加 PUT 动词。 Make the following change your applicationhost.config file for your IIS instance.对 IIS 实例的 applicationhost.config 文件进行以下更改。

<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.您还需要添加您可能允许的任何其他动词,例如 DELETE。

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

It mainly happens due to WebDAV installation to IIS Server.它主要是由于 WebDAV 安装到 IIS 服务器而发生的。

Just add the following XML block in your web.config file只需在您的web.config文件中添加以下 XML 块

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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