ASP.Net 核心 maxUrlLength [英] ASP.Net Core maxUrlLength

查看:47
本文介绍了ASP.Net 核心 maxUrlLength的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在 Asp.Net Core 中设置 maxUrlLength 配置值?我在框架的早期版本的 web.config 中看到这是如何完成的,例如:

Is there a way to set a maxUrlLength configuration value in Asp.Net Core? I see how this is done in web.config in earlier versions of the framework, for example:

如何在 asp.net MVC 3 的配置中增加 maxUrlLength 属性?

然而,这在 ASP.Net Core 中似乎不起作用......

However, this doesn't seem to work in ASP.Net Core....

推荐答案

您是对的,maxUrlLength 配置值不可用在 ASP.net 核心中不可用,因为它在以前的版本中可用.这样做的明确原因是以前的版本只支持 IIS 和 Windows,因此它与它紧密集成.现在它支持其他操作系统,并按照他们使用实际服务器进行反向代理的方式来实现.就像在 Windows IIS 和 Linux NGinx 中一样.

You are correct that maxUrlLength configuration value not available is not available ASP.net core the way it is available in previous version. The clean reason for this is that previous version only support IIS and Windows so it is tightly integrated with that. Now It is supported with other OS and to do that the way they did it reverse proxy with actual server. Like In Windows IIS and Linux NGinx.

  1. IIS 将与 Kestrel 通信.
  2. NGIx 将与 Kestrel 通信.

现在我们必须做的任何请求过滤或 url 设置都是在 IIS 或 NGinx 级别.

Now any request filtering or url setting we have to do is at IIS or NGinx level.

如果您在 Windows 中工作,您会发现请求过滤"功能,为此您必须添加 Web.config 文件.(我没有测试过NGInx)

If you are working in Windows you will find "Request Filtering" feature and for that you have to add Web.config file. ( I have not tested NGInx)

你必须做这样的事情.

<system.webServer>
    <!--   Here you have other settings related to handlers.-->
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="3000000" maxUrl="10241" maxQueryString="20481" />
      </requestFiltering>
   </security>
 </system.webServer>

这篇关于ASP.Net 核心 maxUrlLength的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆