部署后,大文件下载报错:ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接?-灵析社区

一只臭美的Doggg

使用ruoyi-vue-pro开发的,在使用文件管理时,下载上传到服务器上的文件时,当文件过大(目前大于10M)就会报错: 目前发现,会发送2次请求。 .hutool.core.io.IORuntimeException: ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。 at cn.hutool.core.io.IoUtil.write(IoUtil.java:990) at cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.writeAttachment(ServletUtils.java:50) at cn.iocoder.yudao.module.infra.controller.admin.file.FileController.getFileContent(FileController.java:85) at cn.iocoder.yudao.module.infra.controller.admin.file.FileController$$FastClassBySpringCGLIB$$2e43158f.invoke() ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241120/681c0d9b80710d824f7418225d7b5966.png) 求大神帮忙解答

阅读量:27

点赞量:0

问AI
你是直接是java前面没有代理的话应该是java 超时了,你配置一下超时时间 URL url = new URL(fileUrl); URLConnection connection = url.openConnection(); // 设置连接超时时间为60秒 connection.setConnectTimeout(60000); ..... 如果还有nginx就这样配置一下 location /api { proxy_pass http://127.0.0.1:5000; # nginx跟后端服务器连接超时时间 proxy_connect_timeout 300; # 后端服务器数据回传超时时间 proxy_send_timeout 300; # 连接成功后,后端服务器响应超时时间 proxy_read_timeout 300; proxy_set_header Host $host:$server_port; }