The length of the URL for this request exceeds the configured maxUrlLength value is an IIS error telling you the length of the given URL exceeds a limit. IIS default maximum length for a URL is defined by the HttpRuntimeSection.MaxUrlLength property. Its value is 260 characters. This may cause problems with longer than configured maxUrlLength URL’s, and here is how to resolve this issue…

IIS HttpRuntimeSection.MaxUrlLength property: get or set the maximum URL length in IIS

The HttpRuntimeSection.MaxUrlLength property gets or sets the maximum possible length, in number of characters, of the URL in an HTTP request for Windows Server IIS. If an HTTP request is made with a longer URL than defined by maxUrlLength, the following error message is displayed:

Server Error in '/' Application.

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

[HttpException (0x80004005): The length of the URL for this request exceeds the 
 configured maxUrlLength value.]
   System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9020628
   System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +59
IIS Length of URL for request exceeds maxUrlLength value

IIS Length of URL for request exceeds maxUrlLength value

One reason for such a long URL could be the rewriting and minification of CSS stylesheets and JavaScripts. An Magento extension like Fooman Speedster does this, or Autoptimize for WordPress.

How to increase the maximum maxUrlLenght setting in web.config

Fortunately you can fix this error by increasing the maxUrlLenght value for IIS. Add to your web.config file:

<configuration>
  <system.web>
    <httpRuntime maxUrlLength="500" />
  </system.web>
</configuration>

Increase IIS URL size limit – IIS Request Limits

Another option to increase the URL size limit is to configure the <requestLimits> element. The <requestLimits> element specifies limits on HTTP requests that are processed by the web server.

These limits include the maximum size of a request, the maximum URL length, and the maximum length for a query string.

Wondering how to enable NTFS long paths in Windows Server 2016 to increase the 260 characters limitation for NTFS paths?

Request Filtering IIS

Increase IIS URL size and length

Set the Maximum allowed content length, Maximum URL length (Bytes) and Maximum query string (Bytes) to your desired values. The default maximum query string length in IIS is 2048 characters.

When a query string is received by IIS that is longer than 2048 characters, IIS throws a 404.15 - Query String too long error. A value of 2083 characters is the maximum URL length for Internet Explorer by default, and an 404.14 – URL too long error is thrown when a longer URL is requested.

You can increase this maximum URL length value in your web.config, but it’s still browser specific.

IIS Request Limits attributes

  • maxAllowedContentLength: Optional uint attribute. Specifies the maximum length of content in a request, in bytes. The default value is 30000000, which is approximately 28.6 MB
  • maxQueryString: Optional uint attribute. Specifies the maximum length of the query string, in bytes. The default value is 2048
  • maxUrl: Optional uint attribute. Specifies maximum length of the URL, in bytes. The default value is 4096
  • (Source IIS.net requestlimits)