413
unity
network_error
ai_generated
partial
UnityWebRequest:HTTP/1.1 413 请求实体过大
UnityWebRequest: HTTP/1.1 413 Request Entity Too Large
ID: unity/unitywebrequest-error-http-413
90%修复率
87%置信度
1证据数
2024-01-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Unity 2022.3.25f1 | active | — | — | — |
| Unity 2023.3.0b3 | active | — | — | — |
| Unity 2021.3.40f1 | active | — | — | — |
根因分析
服务器拒绝了上传或下载,因为负载超过了服务器配置的最大允许大小,通常是由于过大的资源包或 JSON 数据。
English
The server rejected the upload or download because the payload exceeds the maximum allowed size configured on the server, often due to large asset bundles or JSON data.
官方文档
https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html解决方案
-
Split the upload into multiple smaller chunks using a custom chunked upload implementation, or increase the server's max request size (e.g., in ASP.NET set maxRequestBodySize in web.config).
-
Compress the payload before sending using GZip/Deflate and set Content-Encoding header. Ensure server supports decompression.
无效尝试
常见但无效的做法:
-
95% 失败
Timeout controls how long to wait for a response, not the payload size limit.
-
90% 失败
The 413 error is about request body size, not the HTTP method.
-
85% 失败
Compression affects transfer encoding, not the entity size limit.