来自 Tomcat Azure 的文件上传限制异常
File Upload Limit Exception from Tomcat Azure
我尝试将文件上传到部署在 Azure Web 应用服务中的服务器。
在本地它工作正常,当谈到 azure 时它会抛出一些异常。 FileSizeLimitExceededException。
此上传服务是在JAVASpring引导版本1.5.8
中开发的
Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes
spring:
http:
multipart:
max-file-size: 10MB
max-request-size: 100MB
enabled: true
还尝试了一些 @Bean
实体配置。它对我没有帮助。
已尝试 web.config
使用自定义 server.xml
文件指定 maxPostSize。
我需要将最大上传限制设置为 10MB。
我看到您使用 application.yml
而不是 application.properties
作为 spring-boot 应用程序的配置文件。但是,我担心您的项目中没有 application.properties
文件。正如版本 1.5.8
的 Spring 官方文档的 [24.6 Using YAML instead of Properties
]1 部分所述,
YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data. The SpringApplication class will automatically support YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath.
[Note]
If you use ‘Starters’ SnakeYAML will be automatically provided via spring-boot-starter.
因此,你的项目中必须有SnakeYAML
库,如果没有application.properties
.[=20=,直接添加jar文件或配置maven pom.xml
文件即可]
我尝试将文件上传到部署在 Azure Web 应用服务中的服务器。 在本地它工作正常,当谈到 azure 时它会抛出一些异常。 FileSizeLimitExceededException。
此上传服务是在JAVASpring引导版本1.5.8
中开发的Could not parse multipart servlet request; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes
spring:
http:
multipart:
max-file-size: 10MB
max-request-size: 100MB
enabled: true
还尝试了一些 @Bean
实体配置。它对我没有帮助。
已尝试 web.config
使用自定义 server.xml
文件指定 maxPostSize。
我需要将最大上传限制设置为 10MB。
我看到您使用 application.yml
而不是 application.properties
作为 spring-boot 应用程序的配置文件。但是,我担心您的项目中没有 application.properties
文件。正如版本 1.5.8
的 Spring 官方文档的 [24.6 Using YAML instead of Properties
]1 部分所述,
YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data. The SpringApplication class will automatically support YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath.
[Note] If you use ‘Starters’ SnakeYAML will be automatically provided via spring-boot-starter.
因此,你的项目中必须有SnakeYAML
库,如果没有application.properties
.[=20=,直接添加jar文件或配置maven pom.xml
文件即可]