简体   繁体   中英

.net core 3.1 api file upload error 413 wen i deploy docker image to kubernetes

the webservice works just fine on my computer but after it's deployed it doesn't work anymore and throw this error 413 Request Entity Too Large I added this code to startup.cs file

services.Configure<FormOptions>(x => 
            {
                x.ValueLengthLimit = int.MaxValue;
                x.MultipartBodyLengthLimit = int.MaxValue;
                x.MemoryBufferThreshold = int.MaxValue;
                x.MultipartBoundaryLengthLimit = 209715200;
            });

but didn't help at all. So after some research I added nginx.ingress.kubernetes.io/proxy-body-size: "100m" to deployment.yaml but also didn't help

You can do this: Login server:

sudo nano /etc/nginx/nginx.conf

Set:

client_max_body_size 2M;

This working with me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM