Click here to Skip to main content
15,867,594 members
Articles / Programming Languages / C#
Tip/Trick

Error (Visual Studio 2013, MVC5): The request filtering module is configured to deny a request where the query string is too long

Rate me:
Please Sign up or sign in to vote.
5.00/5 (7 votes)
8 Aug 2014CPOL2 min read 46.4K   2   3
Fix "the query string is too long" error in Visual Studio 2013.

Introduction

When running a MVC5 application in Visual Studio 2013, you may encounter this error. The detailed error information displayed in browser is shown below:

Quote:

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…

Image 1

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.

New project

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.

Image 3

After the project is created, press F5 to run it. The error occurs.

Image 4

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”. 

Image 5

 

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”.

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
Web & Database Developer. Design and implement web and database applications utilizing Microsoft and other development tools.

Comments and Discussions

 
QuestionAnother reason Pin
gchq1-Nov-14 9:20
gchq1-Nov-14 9:20 
QuestionThanks! Pin
j-on18-Oct-14 6:11
j-on18-Oct-14 6:11 
AnswerRe: Thanks! Pin
Tomz_KV20-Oct-14 2:30
Tomz_KV20-Oct-14 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.