问题描述
嗨,我想问一下如何配置blazor服务器端应用程序以允许上传大于28.6MB的文件(本文Size绕的大小:https://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/)。
我正在使用BlazorInputFile和Tewr.Blazor.FileReader。文件大小小于23 MB时,一切正常。较大的文件会挂起应用程序。当发生读入内存流时,两种解决方案都停止。
MemoryStream ms;
using (ms = new MemoryStream())
{
await file.Data.CopyToAsync(ms); <- STOPS HERE
ms.Dispose();
}
或
using (MemoryStream memoryStream = await file.CreateMemoryStreamAsync(100 * 1024 * 1024)) <-STOPS HERE
{
// Sync calls are ok once file is in memory
}
我尝试了多种设置,例如:
services.AddSignalR(e =>
{
e.MaximumReceiveMessageSize = 100 * 1024 * 1024;
});
app.Use(async (context,next) =>
{
context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = null;
await next.Invoke();
});
services.AddServerSideBlazor().AddHubOptions(o => o.MaximumReceiveMessageSize = 100 * 1024 * 1024);
但是它们都不起作用。 有任何想法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)