Web.config设置为405错误 [英] Web.config settings for 405 error

查看:112
本文介绍了Web.config设置为405错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在mvc 5.0 WebApi Web应用程序中执行ajax POST。可以做得很好但是当我尝试使用具有大量数据的GET更新字段时,我得到405错误。



我在右边跟踪还是我看错了方向?



还有什么好/简单的web.config选项参考?



谢谢,

迈克



我的尝试:



我在webDAV的web.config文件中尝试了很多不同的选项,包括完全删除它; 1)在打开或关闭Windows功能中,将其从web.config文件中删除并进行配置。这是我目前在web.config文件中的内容;

I'm trying to do an ajax POST in an mvc 5.0 WebApi web application. Can do a GET just fine but when I try to update a field using GET that has a large amount of data I get the 405 error.

Am I on the right track or am I looking in the wrong direction?

Also is there any good/simple web.config options reference?

Thanks,
Mike

What I have tried:

I've tried many different options in the web.config file pertaining to WebDAV, including completely removing it; 1) In the "Turn Windows features on or off", removing it in web.config file and configuring it. This is what I currently have in my web.config file;

<system.web>
  <authentication mode="None" />
  <compilation debug="true" targetFramework="4.5.1" />
  <httpRuntime targetFramework="4.5.1" />
  <trust level="Full" />
</system.web>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
    <remove name="FormsAuthentication" />
  </modules>
  <handlers>
    <remove name="WebDAV" />
    <add name="WebDAV" path="*" verb="*" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" />
  </handlers>
</system.webServer>

推荐答案

请查看以下代码api示例405示例希望对您有所帮助。

troubleshooting-http- 405-errors-after-publishing-web-api-applications。
Please check below code api example for 405 example hope its help you.
troubleshooting-http-405-errors-after-publishing-web-api-applications.


为那些处于同样位置的人更新一个FYI,在咬牙切齿之后找到了解决方案; < br $>


添加到web.config;



Update just an FYI for those in a like position, found a solution after much gnashing of teeth;

Add to web.config;

<modules runAllManagedModulesForAllRequests="false">
  <remove name="WebDAVModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
  <remove name="WebDAV" />
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>



甚至在此之后它不起作用所以经过更多的研究我发现你只能在ajax帖子中传递一个参数。在我改变后,一切都很好。


and even after that it did not work so after more research I found that you can only pass one parameter in an ajax post. After I changed that everything worked great.


这篇关于Web.config设置为405错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆