本文介绍了Web.config设置为405错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试在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,MikeWhat 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>推荐答案<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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!