的WebAPI删除不工作 - 405不允许的方法 [英] WebAPI Delete not working - 405 Method Not Allowed

查看:153
本文介绍了的WebAPI删除不工作 - 405不允许的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我AP preciate有这方面的帮助,因为该网站是应该在今晚!

I appreciate any help on this as the site is supposed to go live tonight!

我有一个删除方法的Web API控制器。该方法执行,只要我把它部署到现场IIS服务器(Windows Server 2008 R2),它停止工作,引发以下错误消息罚款我运行IIS防爆preSS(Windows 8中),但在本地计算机上:

I have a web api controller with a Delete method. The method executes fine on my local machine running IIS Express (Windows 8) but as soon as I deployed it to the live IIS server (Windows Server 2008 R2) it stopped working and throws the following error message:

HTTP错误405.0 - 不允许的方法
无法显示您正在查找的页,因为正在使用无效的方法(HTTP动词)是

我已经看过网络解决方案,为周围,我实现了最合理的。我的web配置具有以下设置:

I have looked around the web for solutions and I implemented most reasonable ones. My web config has the following settings:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
<handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>

我也试图在IIS中改变处理程序映射,并请求筛选无济于事。请注意,WebDAV创作规则在IIS中似乎被禁用。

I have also tried to change the Handler Mappings and Request Filtering in IIS to no avail. Please note that the WebDAV Authoring Rules in IIS seems to be disabled.

任何想法将大大AP preciated
谢谢你。

Any ideas will be greatly appreciated Thanks.

推荐答案

我找到了解决办法,最终!
如果你遇到了同样的问题,以下内容添加到你的web.config

I found the solution eventually! If you come across the same issue, add the following to your web.config

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">
        <remove name="WebDAVModule"/> <!-- ADD THIS -->
    </modules>
    ... rest of settings here

我希望这有助于

这篇关于的WebAPI删除不工作 - 405不允许的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆