Asp.net Core 2.0 RequestSizeLimit attribute not working

后端 未结 2 611
天命终不由人
天命终不由人 2020-12-06 10:25

I\'m creating a website in Asp.net core 2.0 which allows files to be uploaded. I quickly came across the problem of the 30MB upload limit and receive a 4

2条回答
  •  不知归路
    2020-12-06 10:42

    The RequestSizeLimit attribute allows you to define the maximum request size within your code but it is still limited by maximum request size supported by the server itself.

    In this case, I suspect you're receiving this error:

    HTTP 404.13 - Not Found
    The request filtering module is configured to deny a request that exceeds the request content length.
    

    This error is being triggered by ISS because the call exceeded IIS' maxAllowedContentLength value (the default is 30,000,000). From the documentation:

    The following error indicates your file upload exceeds the server's configured maxAllowedContentLength. The default setting is 30000000, which is approximately 28.6MB. The value can be customized by editing the web.config:

    
      
        
          
          
        
      
    
    

提交回复
热议问题