This is the 23rd day of my participation in the August More Text Challenge.More challenges in August
[bug Mc-10868] – project uploads more than 50M files and the front end reports an error with no status return and no response. A net::ERR_CONNECTION_RESET error is displayed only in the browser Console.
Anything within 50M can be transmitted, the first reaction must be configuration or parameter limitation. Since it is Linux deployed, nginx then does a reverse proxy, checks the code, and the size limit on running the program has been lifted.
Then there was the NGINx limit, which allowed the operation and maintenance to change the size limit, but it still didn’t work. Because the developers didn’t have access to the deployment environment, operations said the configuration had been changed, and I ended up debugging the problem myself in the local emulation environment (using the IIS deployment for the local test).
As WSL2 is installed on my machine, I am going to use WSL2 to test and play. For WSL2 installation, you can see the installation of Linux subsystem (WSL2, Ubuntu) on Windows10 with Windows Terminal
Interfaces and services modify upload limits
Request size limit of the interface. Type DisableRequestSizeLimit on the method.
Kestrel MultipartBodyLengthLimit
Independent deployment
The.net Core native test environment is typically deployed using a pre-installed runtime, but containers are typically self-contained runtimes, so use standalone deployment to go a long way.
You can use the command to publish, vs direct operation on the line.
Right-click publish, set standalone deployment mode, and select the target runtime Linux-X64.
After WSL installs Unbuntu, local disks are already mounted under MNT. So you can directly access the directory launcher on Windows, which is where WSL comes in handy.
We go to the program directory and execute the main program. == Note: == if the program is already in the directory, execute with the form./ and then./ XXX.
There is no need to install anything or dependencies, the program is already started. Next we install nginx
Nginx installation and configuration
Install Nginx using apt-get.
sudo apt-get install nginx
Start nginx after the installation is complete
sudo service nginx start
Nginx uses port 80 by default, but when I started it, I was told that the port was occupied. WSL and Windows share ports.
SQL Server Reporting Services (SQL Server Reporting Services, SQL Server Reporting Services, SQL Server Reporting Services)
If you do not have to use port 80, you can change the nginx port to another one in the configuration to prevent common port conflicts.
Nginx is configured as a reverse proxy to forward requests to ASP.NET Core applications. Modify /etc/nginx/sites-available/default.
sudo vim /etc/nginx/sites-available/default
Using vim to change the configuration to the following, I changed the nginx port to 5000
server { listen 5000; location / { proxy_pass http://localhost:5004; Proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }}Copy the code
After configuring Nginx, run sudo Nginx -t to verify the syntax of the configuration file. If the configuration file is successfully tested, reload it by running sudo nginx -s reload.
Test and find problems
After completing the above two steps, just go to http://localhost:5000 in the Windows browser and test it.
413 requset entity too large, kestrel did not report an error, so set nginx configuration client_max_body_size to 3000m.
It is ok to upload a few hundred megabytes file again, I reported an error when I uploaded a 1.5 GIGAByte file.
Set proxy_read_timeout size to 3600s. Other nginx time Settings do not need to be modified.
Run sudo nginx -s reload
In the end, all uploads of different sizes under 2G were successfully uploaded.
The last
I explained the situation to operations with the local tests, at least to make sure that the program was working and that nginx was going to have problems.
Of course, the online environment is more complex than my test environment and needs to be checked (maybe the configuration is not effective or incorrect). I just share the simple deployment, installation and problem finding process here.
== Another note: ==
Deployment after startup services at Microsoft. The Data. SqlClient. DLL is not supported by the target platform. Finally, the copy inside the runtime is replaced by the program below the problem, and the file inside the runtime is more than 1M, generated only a few hundred K.