maxRequestPathLength 不在 ASP.NET 4 文档中并且不起作用
如果我尝试在 ASP.NET 应用程序中使用新的 maxRequestPathLength 设置,它将不起作用。我收到无法识别的属性错误。我尝试过在 IIS 7 中使用 ASP.NET Integrated 和 Classic 应用程序池。同样有趣的是,如果您在 MSDN 上搜索 maxRequestPathLength,除了 ASP 新功能列表之外,在文档中找不到任何地方.NET 4. 带来了什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
显然,此设置名称已更改并移至“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters”下的注册表。名称为 UrlSegmentMaxLength。默认值为 260。此特定设置限制 URL 的每个路径段中允许的字符数。在 https://stackoverflow.com/questions 中,“questions”将是一个路径段。
有关此内容的文档可以在有关 http.sys 注册表设置 的 Microsoft 知识库文章中找到。
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.
我一直在努力解决这个问题,在这篇文章和其他几篇论坛文章的帮助下,它对我有用。这是我的日志和发现:
要允许比默认值更长的 url,只需在 web.config 中更改此设置(.NET 4.0 及更高版本)
注意:如果relaxedUrlToFileSystemMapping 设置为 false,则大于 260 的 urlsegments 将失败并出现 IOException PathTooLongException:
要允许更长的 url 段,然后默认 260 添加/更改此注册表设置:
最重要的是更改此设置后。 重新启动您的机器。
我尝试过 IIS-Reset 和 net stop http / net start http,但这并没有使更改生效。
目前我有 2 台机器可用。
我的本地开发机器(Windows 7 / IIS 7.5)和开发服务器(Windows 2003 / IIS 6.0)
两者都重新启动以使更改生效。
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)
Note: if relaxedUrlToFileSystemMapping is set te to false, urlsegments larger then 260 wil fail with an IOException PathTooLongException:
To allow longer url segments then the default 260 add/change this registry setting:
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.
这让我困惑了一段时间。在 .NET 4 中执行此操作的方法如下:
在 web.config 的
部分中。我这样做了并且成功了。This had me foxed for a little while. The way to do this in .NET 4 is like this:
in the
<system.web>
section of the web.config. I did this and it worked.