更新时间:2022-10-29 10:24:07
转到处理程序映射在 IIS管理器即可。找到 ExtensionlessUrlHandler-集成-4.0
,双击它。点击请求限制... 按钮和动词选项卡上,同时添加删除
和 PUT
。
编辑:可能的WebDav出版商问题
您已经提上你是在2008年的服务器对运行后删除?尝试删除的WebDAV 角色,或者从您的站点禁用配置
:在 system.webServer
- > 模块
部分,删除 WebDAVModule
模块:
< system.webServer>
<模块>
<清除NAME =WebDAVModule/>
< /模块>
<&处理GT;
<清除NAME =WebDAV的/>
< /处理器>
< /system.webServer>
I use HTTP PUT
and DELETE
in my ASP.NET MVC3 application. When I run it in local, every thing works correctly; But when I publish the application to the server, these methods do not work.
Are there any special settings for enable a web server to support PUT
and DELETE
requests? I'm using shared hosting with IIS 7.5.
UPDATE:
I enable PUT
and DELETE
requests in IIS manager
. PUT
command work fine. But DELETE
still not works. I create requests by jQuery
:
I'm in this page:
http://domain.com/dashboard/edit-site/103323/links/
and my ajax call is:
$.ajax({
// url: same as page-url,
cache: false,
type: 'DELETE',
data: { linkid: $(link).data("linkid") },
beforeSend: function () {
// doing something in UI
},
complete: function () {
// doing something in UI
},
success: function (data) {
// doing something in UI
},
error: function () {
// doing something in UI
}
});
This will create a request like this:
Accept: */*
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: http://domain.com
Referer: http://domain.com/dashboard/edit-site/103323/links/
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1
X-Requested-With: XMLHttpRequest
With this Form Data
:
linkid:104044
Go to Handler Mappings in your IIS Manager. Find ExtensionlessUrlHandler-Integrated-4.0
, double click it. Click Request Restrictions... button and on Verbs tab, add both DELETE
and PUT
.
EDIT: Possible WebDav Publisher issue
You've mention on a deleted post you were running on a 2008 server right? Try removing webDav role, or disable it from your site config
: on system.webServer
-> modules
section, remove WebDAVModule
module:
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
</system.webServer>