When running a MVC5 application in Visual Studio 2013, you may encounter this error. The detailed error information displayed in browser is shown below:
HTTP Error 404.15 - Not Found
The request filtering module is configured to deny a request where the query string is too long.
Most likely causes:
Request filtering is configured on the Web server to deny the request because the query string is too long.
Things you can try:
Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxQueryString setting in the applicationhost.config or web.config file.
The error occurs particularly when IIS Express, the default web server in Visual Studio 2013, is used.
Steps to Reproduce the Error
Start Visual Studio 2013, and click on File – New – Project…
In the New Project dialog box, click Web on the left pane and ASP.NET Web Application on the right pane, give a project name and then OK.
On the next New ASP.NET Project dialog box, select MVC template and select Individual User Accounts as authentication method. If the Individual User Accounts is not already selected, click the Change Authentication button to change it. Click Ok button.
After the project is created, press F5 to run it. The error occurs.
How to Fix
In the “Things you can try” section of the error message, it suggests to increase the maxQueryString length in configuration settings. This suggestion might work in some cases, but certainly did not work for me. It turns out that the error is caused by inappropriate settings in project properties. Look at the screen shot of the project properties below in which the Windows Authentication is “Enabled” and the Anonymous Authentication is Disabled”.
Not sure why the Windows Authentication is “Enabled” while the “Individual User Accounts”, which refers to Form Authentication, is selected during the initial project creation. The fix is easy, by simply changing the Windows Authentication to “Disabled” and the Anonymous Authentication to “Enabled”.