How do I increase the maxUrlLength property in the config in asp.net MVC 3?

asp.net Mvc

asp.net Mvc Problem Overview


I am getting this error:

> The length of the URL for this request exceeds the configured > maxUrlLength value.

Looking around the closest thing I can find is in the web.config,

<requestFiltering>
   <requestLimits maxUrl="xxx">
</requestFiltering>

However this is not MaxUrlLength nor does it resolve the issue. Any ideas how to fix?

asp.net Mvc Solutions


Solution 1 - asp.net Mvc

As per Ashok's answer that would equate to:

<httpRuntime maxUrlLength="1024" relaxedUrlToFileSystemMapping="true"/>

within <system.web> section of the web.config.

Solution 2 - asp.net Mvc

Take a look at this post by Hanselman. Although this post is about accepting typically invalid characters in the URL he also mentions how to configure the length of the path and the query string

> While we're in here, note that in ASP.NET 4 you can also change allowed path and queryString lengths:

>

Solution 3 - asp.net Mvc

I had this problem in a rest service I created using C# .net 4. I set the maxUrlLength variable, in the system.web section, of the Web.Config file.

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxUrlLength="2000"/>
  </system.web>
....

Solution 4 - asp.net Mvc

have you seen this msdn article that seems to what you need

Solution 5 - asp.net Mvc

Having the same problem in IIS8, the solution was to modify the root Web.config for the .NET Framework. This file is located in %windir%\Microsoft.NET\Framework\framework_version\CONFIG. Editing the web.config file in the site root did not resolve the issue.

Solution 6 - asp.net Mvc

In my case, I edited the setting visually in the IIS application (Request Filtering area):

request filtering url length

This action modified my web.config as follows:

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="524288000" maxQueryString="4096" />
  </requestFiltering>
</security>

As was mentioned in some of the other answers, be sure to also consider long query strings in the request.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNibblyPigView Question on Stackoverflow
Solution 1 - asp.net MvcJesseView Answer on Stackoverflow
Solution 2 - asp.net MvcHector CorreaView Answer on Stackoverflow
Solution 3 - asp.net MvcVanView Answer on Stackoverflow
Solution 4 - asp.net MvcAshok PadmanabhanView Answer on Stackoverflow
Solution 5 - asp.net Mvcuser3594326View Answer on Stackoverflow
Solution 6 - asp.net MvcMarcel GruberView Answer on Stackoverflow