.net core 2.2下的Ubuntu 18.04服务器启动了一个网站。文件正常上传到站点,但是下载时发生404错误。
Nginx配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location / {
proxy_pass http://localhost:5000;
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;
#try_files $uri $uri/ =404;
}
}
文件生成并通过以下代码发送:
public FileResult Download(int id)
{
byte[] fileBytes = null;
string fileName = "";
//getting file data and name
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
请告诉我,出什么问题了