.netcore context.Request.EnableRewind() 一旦缓冲区超过就抛出 System.IO.Exception
.netcore context.Request.EnableRewind() throwing System.IO.Exception once buffer exceeds
我们有一个使用 netcoreapp2.0 的生产部署应用程序
我们使用 context.Request.EnableRewind();在处理之前读取并记录请求。
几天以来,我们在 AWS Docker ECS 中托管的 kestrel 中遇到了未处理的异常。
基本上我们的请求大小超过 30 Kb,这就是为什么 netcore 试图使用文件系统缓冲区来倒带请求。它正在抛出 File is readonly 异常。
增加默认缓冲区限制是解决此问题的唯一方法。
context.Request.EnableRewind([int bufferthreashold 30720],long? bufferLimit = null]);
或者有任何其他方法来配置请求倒带?
我们现在无法选择升级到 2.1。我看到它已在 2.1
中修复
2019-06-24 14:09:49[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
2019-06-24 14:09:49 Connection id "0HLKCN30834Q0",
Request id "0HLKCN30834Q0:0003B777": An unhandled exception was thrown by the application.
Connection id "0HLKCN30834Q0", Request id "0HLKCN30834Q0:0003B777": An unhandled exception was thrown by the application.
2019-06-24 14:09:49System.IO.IOException: Read-only file system
System.IO.IOException: Read-only file system
通过增加默认缓冲区大小修复了它。
我们有一个使用 netcoreapp2.0 的生产部署应用程序 我们使用 context.Request.EnableRewind();在处理之前读取并记录请求。
几天以来,我们在 AWS Docker ECS 中托管的 kestrel 中遇到了未处理的异常。
基本上我们的请求大小超过 30 Kb,这就是为什么 netcore 试图使用文件系统缓冲区来倒带请求。它正在抛出 File is readonly 异常。
增加默认缓冲区限制是解决此问题的唯一方法。
context.Request.EnableRewind([int bufferthreashold 30720],long? bufferLimit = null]);
或者有任何其他方法来配置请求倒带? 我们现在无法选择升级到 2.1。我看到它已在 2.1
中修复2019-06-24 14:09:49[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
2019-06-24 14:09:49 Connection id "0HLKCN30834Q0",
Request id "0HLKCN30834Q0:0003B777": An unhandled exception was thrown by the application.
Connection id "0HLKCN30834Q0", Request id "0HLKCN30834Q0:0003B777": An unhandled exception was thrown by the application.
2019-06-24 14:09:49System.IO.IOException: Read-only file system
System.IO.IOException: Read-only file system
通过增加默认缓冲区大小修复了它。