asp.net – ashx处理程序DELETE请求不工作HTTP 405.0
尝试从我试图实现的
jquery文件上传器向.ashx处理程序发出DELETE请求时,我收到HTTP错误405.0 – 方法不允许错误.
引用这个问题(https://stackoverflow.com/questions/6695587/enabling-put-on-iis-7-5-for-an-ashx-handler-using-windows-authentication)我已将以下部分添加到我的web.config文件,但似乎无法让错误消失.有没有其他技巧我找不到让DELETE工作? 我正在使用.Net 4.0和IIS7.5,同时运行windows azure存储模拟器. <system.webServer> <modules> <remove name="WebDAVModule" /> </modules> <handlers accessPolicy="Read,Write,Execute,Script"> <remove name="WebDAV" /> <remove name="SimpleHandlerFactory-Integrated-4.0" /> <remove name="SimpleHandlerFactory-Integrated" /> <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode" /> <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> <security> <authorization> <remove users="*" roles="" verbs="" /> <add accessType="Allow" users="*" verbs="GET,DELETE,DEBUG" /> </authorization> </security> </system.webServer> 这是调用处理程序的前端代码: <td class="delete"> <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" data-url="/webservices/FileTransferHandler.ashx?f=df69bfd1-2a15-43e3-9310-3ca163e2aeb2" data-type="DELETE" role="button" aria-disabled="false" title="Delete"> <span class="ui-button-icon-primary ui-icon ui-icon-trash"></span> <span class="ui-button-text">Delete</span> </button> </td> 我已经启用了失败的请求跟踪,它正在尝试使用staticFileModule,同时基于.ashx的请求扩展我认为它会尝试使用SimpleHandlerFactory. 这是我正在打的链接:http://local.testsite.com:80/webservices/FileTransferHandler.ashx?f=df69bf1-2a15-43e3-9310-3ca163e2aeb2 为什么该链接会使用staticFileModule,而不是像.jpg和.pdf这样的图像或文档? 解决方法
这是最后的web.config部分.我需要添加的东西是缺少的是将staticFileHandler从使用“所有动词”更改为拼写出来的所有动词.
<system.webServer> <modules> <remove name="WebDAVModule" /> </modules> <handlers accessPolicy="Read,Script"> <remove name="StaticFile" /> <remove name="SimpleHandlerFactory-ISAPI-2.0" /> <remove name="WebDAV" /> <remove name="SimpleHandlerFactory-Integrated-4.0" /> <remove name="SimpleHandlerFactory-Integrated" /> <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,runtimeVersionv4.0" /> <add name="SimpleHandlerFactory-ISAPI-2.0" path="*.ashx" verb="GET,DELETE" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFrameworkv2.0.50727aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> <add name="StaticFile" path="*" verb="GET,DELETE" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> </handlers> <security> <authorization> <remove users="*" roles="" verbs="" /> <add accessType="Allow" users="*" verbs="GET,DEBUG" /> </authorization> </security> <tracing> <traceFailedRequests> <remove path="*" /> <add path="*"> <traceAreas> <add provider="ASP" verbosity="Verbose" /> <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" /> <add provider="ISAPI Extension" verbosity="Verbose" /> <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,FastCGI" verbosity="Verbose" /> </traceAreas> <failureDefinitions statusCodes="405" /> </add> </traceFailedRequests> </tracing> </system.webServer> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc – ASP.NET中的Response.Write是一个坏主意吗?
- asp.net-core – ASP.NET vNext – 本地化(.resx)
- asp.net-mvc – 如何在html.LabelFor中显示一些文本?
- asp.net – <%和<%之间有什么区别:
- 单元测试 – ASP .NET Web API控制器测试
- asp.net中的pagemethods
- ASP.NET拒绝访问该路径
- asp.net – 使用Visual Studio中的查询字符串参数进行调试
- ASP.NET MVC模型绑定IList <>参数
- .net – 设置runat = server时输入名称和ID更改
- asp.net – 为什么我的动态添加控件会在Postback
- asp.net – Microsoft Jet数据库引擎找不到对象’
- asp.net-mvc-3 – 用于ASP.NET MVC的Razor View
- asp.net – WebApi:如何处理图像
- 剃刀 – 输入隐藏显示不正确的ID(Guid.Empty)
- asp.net – 在IIS URL Rewrite 2中重新处理重写的
- Razor Page Library:开发独立通用RPL(内嵌wwwr
- 嵌套的ASP.NET’应用程序’在IIS内继承父配置值?
- asp.net – 检测到NonComVisibleBaseClass;我该如
- asp.net-mvc – ConfigurationManager读取错误的