嗨,我想问一下如何配置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);
但是它们都不起作用。 有任何想法吗?
答案 0 :(得分:0)
不确定仍然是这种情况,但是以前我必须添加一个web.config文件,即使它们实际上没有在.net core中使用,也必须添加以下条目:
num_records = 2
values = ["rate_" + str(i+1) for i in range(num_records)]
df.groupBy("group").pivot("rank", values=values).agg(first("rate")).show()
#+-----+------+------+
#|group|rate_1|rate_2|
#+-----+------+------+
#| B| 0.1| 0.3|
#| C| 0.1| 0.2|
#| A| 0.1| 0.2|
#+-----+------+------+