Nginx中的Asp.net Core大型文件上传连接超时问题

时间:2018-12-14 07:30:05

标签: c# asp.net-mvc linux nginx asp.net-core

我已在Digital Ocean 10 $ Ubuntu Droplet中运行了Asp.net核心应用程序,上传多个或大文件时出现问题,一段时间后连接断开,不知道该怎么办是我的代理设置:

    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    client_max_body_size 1000m;
    client_body_buffer_size 1000m;
    uwsgi_read_timeout     1000s;
    proxy_connect_timeout 90;
    proxy_send_timeout 100;
    proxy_read_timeout 100s;
    fastcgi_send_timeout 1000s;
    fastcgi_read_timeout 1000s;
    proxy_buffers 32 4k;

1 个答案:

答案 0 :(得分:0)

您是否尝试过此操作

None

或Program.cs进行全局设置

[RequestSizeLimit(1024*1024*100)]
public IActionResult Post(){
}

或来自中间件的

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseKestrel(options =>
    {
        options.Limits.MaxRequestBodySize = 1024*1024*100; //100MB
    });
}