2

If I try to use the new maxRequestPathLength settings in an ASP.NET application it does not work. I get an unrecognized attribute error. I've tried using both ASP.NET Integrated and Classic application pools in IIS 7. What is also funny is that if you search for maxRequestPathLength on MSDN it is no where to be found in the documentation except in the list of new features for ASP.NET 4. What gives?

3 Answers 3

3

Apparently this setting name was changed and move to the registry under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters." The name is UrlSegmentMaxLength. The default value is 260. This particular setting limits the amount of characters allowed in each path segment of a URL. In https://stackoverflow.com/questions, "questions" would be a path segment.

Documentation for this can be found in the Microsoft knowledge base article on http.sys registry settings.

Sign up to request clarification or add additional context in comments.

8 Comments

Not sure who down-voted my answer, but it would be nice to know why you did. There's nothing wrong with answering your own question, especially when one puts forth the effort to find one's own answer months after asking the question.
I'm not sure either Bob (it wasn't me, but I also didn't upvote it either). I think my answer is more useful as it doesn't require access to the registry (very rare in shared hosting environment, for example). This is one of those .NET features which seems to have changed a bit since they first published information about it.
+1 @Bob I am encountering the same issue. Did you find adding a registry entry solved the issue? I'm running IIS 7 and IIS 7. I added the registry DWORD for UrlSegmentMaxLength and it did not have an effect.
@ChuckConway Sorry for the late reply. I didn't see your comment until now. You have to restart IIS completely for it to take effect. If you look at the article at the link posted in my answer it explains how to restart IIS. After doing that the issue should be fixed.
@ChuckConway: did you try my answer (above)? This worked for me without needing to access the registry at all.
|
3

I've been struggling with this and with help of this post en several other forum post made it work for me. Here is my log and findings:

To allow longer url's then default, just change this in your web.config (.NET 4.0 and up)

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

Note: if relaxedUrlToFileSystemMapping is set te to false, urlsegments larger then 260 wil fail with an IOException PathTooLongException:

The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

To allow longer url segments then the default 260 add/change this registry setting:

"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters." The name is UrlSegmentMaxLength. (Dword)

And most importantly after changing this setting. REBOOT your machine. I've tried IIS-Reset and net stop http / net start http, but this did not make the change effective.

Currently i have 2 machines available. My local dev-machin (Windows 7 / IIS 7.5) and a dev-server (Windows 2003 / IIS 6.0) Both took a reboot to make the changes effective.

1 Comment

Confirmed: registry fix and reboot required, I had an MVC API endpoint that had too plentiful of parameters and this was required for the API documentation page. WebConfig alone worked in IIS express, but not once deployed w/o registry fix.
1

This had me foxed for a little while. The way to do this in .NET 4 is like this:

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

in the <system.web> section of the web.config. I did this and it worked.

1 Comment

This only works on local cassini, not default IIS 7 setting. The registry setting needs to be changed on IIS, as shown in the other answers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.