HTTP Error 404.15 -Not Found

和自甴很熟 提交于 2020-06-17 03:39:09

问题


The request filtering module is configured to deny a request where the query string is too long.

I am having above error, and I have been trying almost everything but no luck

My Project is MVC4 on Visual Studio 2013

things I have made sure are correct and tried.

  • There is no [Authorize] Attr on my classes with [AllowAnonymous] Attr.
  • I have added maxQueryStringLength="32768" maxUrlLength="65536" to in my config file
  • I have added -->
  • I have [AllowAnonymous] attr on my log on Actions in my controller.

  • I have no problem when I run the application in debug mode or without debug mode on Visual Studio.

  • here is my rout config routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } );

  • this is the error I am getting on the web server


回答1:


As the error message tells you

The request filtering module is configured to deny a request where the query string is too long.

At the screenshot you can clearly see that the returnUrl Parameter is huge.

So there are to solutions

  1. Clear your returnUrl Parameter in your Controller Method [HttpPost] Login();

  2. Add the following to your web.config :

web.config

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxQueryString="*"/> <!-- Replace * with any number, which is required -->
    </requestFiltering>
  </security>
</system.webServer>

In your case go definitively with Solution 1. It's simply a bug in your Code and easily fixed without touching the IIS or other config files.

See this post for more information about Request Query String Limit.




回答2:


Insert/Update web.config file as like sample below

<configuration>
   <system.webServer>
       <security>
          <requestFiltering>
             <requestLimits maxQueryString="3000" maxUrl="1000" />
          </requestFiltering>
       </security>
   </system.webServer>
   <system.web>
       <httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>
   </system.web>
</configuration>



回答3:


I had the same problem, I replaced GET method with POST and it worked.



来源:https://stackoverflow.com/questions/42370214/http-error-404-15-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!