MVC 3 Razor Ajax HttpDelete IIS6
我正在尝试通过 jQuery 向控制器执行删除请求。在本地它可以工作,但是当部署到服务器时我收到 501 状态。
我已经确认,对于 .cshtml,所有动词都被接受,并且不需要文件验证(我在其他地方读过这篇文章,但我不知道它会实现什么,因为我没有调用 cshtml 页面)。我还需要更改其他申请延期吗?
I'm trying to execute a delete request via jQuery to a controller. Locally it works but when deployed to the server I receive a 501 status.
I have confirmed that for .cshtml that all verbs are accepted and that file verification is not needed (I read this elsewhere but I don't see what it would achieve anyway as I am not calling a cshtml page). Is there some other application extension I need to change allowances for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了在 ASP.NET MVC 中,您没有向
.cshtml
文件发送请求。在 ASP.NET MVC 中,您将请求发送到控制器操作。它们取决于您的路由配置。开箱即用的 IIS 6.0 不支持无扩展名 url,因此您无法使用默认路由,除非您 配置 IIS。因此,您必须允许对 IIS 6.0 中使用的任何扩展使用 DELETE 动词,或者如果您配置了无扩展 url,则需要为 aspnet_isapi 扩展启用它。
Except that in ASP.NET MVC you are not sending requests to
.cshtml
files. In ASP.NET MVC you are sending requests to controller actions. And they depend on your routing configuration. Out of the box IIS 6.0 doesn't support extensionless urls, so you cannot use the default routes unless you configure IIS.So you will have to allow the DELETE verb to whatever extension you are using in IIS 6.0, or if you have configured extensionless urls, you will need to enable it for the aspnet_isapi extension.