Home > Software engineering >  web config requestFilteringModule
web config requestFilteringModule

Time:07-22

I'm trying to host my application on a server but I got this error:

HTTP Error 404.15 - Not Found
-Request filtering is configured on the Web Server to deny the request because the query string is too long

After some research, I found that I should insert some code into web.config:

<requestFiltering>
    <requestLimits maxAllowedContentLength="1073741824"/>
<requestFiltering/>

However, after I add this line of code, then I have another error that the line above is casing it:

-The Requested page cannot be accessed because the related configuration data for the page is invalid.
Config file :\\c:\inetpub\wwwroot\web.config

How can I solve this issue? Thank you in advance

enter image description here

CodePudding user response:

HTTP Error 404.15 – Not Found. The request filtering module is configured to deny a request where the query string is too long.

The possible scenario for this error: when IIS Express is hosted by using the default web server in the Visual studio.

This issue can be resolved using any one of the solutions given below.

Solution 1: Enable the Anonymous Authentication property in the project properties. Steps to enable the Anonymous Authentication Property:

Step 1: Open the project file.

Step 2: Right-click on any folder and select Properties. The Properties pane is opened.

Step 3: Select the project file and Properties pane for the project is displayed.

Step 4: Enable the Anonymous Authentication by selecting the Enabled option from the dropdown.

enter image description here

Solution 2:

Increase the value of the maxQueryString in web.config file. Please refer the below code example to define the value of maxQueryString in web.config file.

Web.Config:

<system.web>

   <httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" /> <!-- Replace * with any number, which is required -->

   ……
       
</system.web>


<system.webServer>

  <security>

    <requestFiltering>

      <requestLimits maxUrl="10999" maxQueryString="2097151" /> <!-- Replace * with any number, which is required -->

    </requestFiltering>

  </security>

</system.webServer>
  • Related