问题描述
我已经检查一切,没有配置的是工作的罚款。
I have checked everything and none of the configuration is working fine.
在GET,POST与放我得到405的邮件,但是工作。
我没有Webdev的。
THE GET, POST is working however with put I am getting 405 message.I don't have WebDEV.
这是我的配置。
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV"/>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
据我发疯!
我已经提到的所有可用的建议,如:
Asp.NET网络API - 405 - 用来访问本页面的HTTP动词是不允许的 - 如何设置处理器映射
I have referred all available suggestions such as :Asp.NET Web API - 405 - HTTP verb used to access this page is not allowed - how to set handler mappings
虽然我使用基本身份验证/ Windows验证。禁用这也没什么区别。
Even though I am using Basic Auth/ Windows Auth. disabling this also makes no difference.
[System.Web.HttpHttpPut]
公共覆盖的Htt presponseMessage把(INT ID,请求实体)
{
....
}
[System.Web.HttpHttpPut] public override HttpResponseMessage Put(int id, Request entity){ ....}
请注意:我刚才已经把临时服务器上,它一直。但是,它不工作我的机器上...
推荐答案
你是从正确的命名空间装饰与HttpPut你的行动?
应该是这个样子:
Did you decorate your action with HttpPut from the correct namespace?Should look something like this :
[HttpPut]
public ActionResult ActionName()
{
//Your code
}
编辑:显然前非法入境preSS已删除&安培;认沽默认为禁用。
如果这只是在IIS前preSS情况你可能会发现this回答有用。
Basicly你必须编辑这个文件:
Apparently iis express has delete & put disabled by default.If this only happens in iis express you might find this answer usefull.Basicly you have to edit this file :
%userprofile%\documents\iisexpress\config\applicationhost.config
在这一行:
<add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
和添加动词PUT
编辑NR 2:结果
继This anwser :打开你的IIS管理器,然后选择您网站的结果。
点击右侧的处理程序映射链接。结果
找到ExtensionlessUrlHandler - 集成 - 4.0项并双击它。结果
在请求限制选项卡中的动词可以再加入放,使认沽支持。
Edit nr 2:
Following This anwser : open up your iis manager and select you website.
Click handler mapping link on the right.
Find the ExtensionlessUrlHandler-Integrated-4.0 entry and double click it.
In Request Restrictions tab verbs you can then add put to enable put support.
这篇关于405不允许的方法PUT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!