gpt4 book ai didi

c# - IHttpHandler 不会接受 DELETE 或 PUT 请求

转载 作者:行者123 更新时间:2023-11-30 18:04:01 24 4
gpt4 key购买 nike

我有一个 .ashx 文件,我希望人们可以向其调用 DELETE 请求。我总是收到 405 Method not allowed 错误。我一直在做一些研究,我发现了很多关于更改 web.config 的东西,因为 IIS 需要允许这些类型的请求。有任何想法吗?我正在使用共享点,我需要修改 webconfig 文件。这是 web.config 文件的一部分:

<handlers accessPolicy="Read,Execute,Script">
<remove name="OPTIONSVerbHandler" />
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="svc-Integrated" />
<remove name="WebDAV" />
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
<add name="OwssvrHandler" scriptProcessor="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\isapi\owssvr.dll" path="/_vti_bin/owssvr.dll" verb="*" modules="IsapiModule" preCondition="integratedMode" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="JSONHandlerFactory" path="*.json" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" preCondition="integratedMode" />
<add name="ReportViewerWebPart" verb="*" path="Reserved.ReportViewerWebPart.axd" type="Microsoft.ReportingServices.SharePoint.UI.WebParts.WebPartHttpHandler, Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<add name="ReportViewerWebControl" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</handlers>

编辑:

我正在使用 IIS7

最佳答案

在 IIS7 中,确保在允许的动词中指定了 DELETE。

Sites > Default Web Site > [your app] > Request Filtering > Http Verbs Pane

关于c# - IHttpHandler 不会接受 DELETE 或 PUT 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6618664/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com