ASP.Net Core maxUrlLength

后端 未结 2 1644
天涯浪人
天涯浪人 2020-12-10 13:49

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:

Ho

相关标签:
2条回答
  • 2020-12-10 14:12

    Maybe this can help

    KestrelServerLimits.MaxRequestLineSize Property

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.server.kestrel.core.kestrelserverlimits.maxrequestlinesize?view=aspnetcore-3.1#Microsoft_AspNetCore_Server_Kestrel_Core_KestrelServerLimits_MaxRequestLineSize

    0 讨论(0)
  • 2020-12-10 14:23

    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 will communicate with Kestrel.
    2. NGIx will comminicate with Kestrel.

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

    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>
    
    0 讨论(0)
提交回复
热议问题