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

查看:68
本文介绍了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配置值与以前版本中的可用方式一样,不可用.这样做的明确原因是以前的版本仅支持IIS和Windows,因此与之紧密集成.现在,它在其他OS上受支持,并且这样做的方式与他们在实际服务器中的反向代理相同.就像在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)

您必须执行类似的操作.

You have to do something like this.

<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天全站免登陆