System.IO.IOException: Supplied file with size 2137625 bytes exceeds the maximum of 512000 bytes.

报错信息如下:

System.IO.IOException: Supplied file with size 2137625 bytes exceeds the maximum of 512000 bytes.
   at Microsoft.AspNetCore.Components.Forms.BrowserFile.OpenReadStream(Int64 maxAllowedSize, CancellationToken cancellationToken)
   at BootstrapBlazorApp.Shared.Pages.PC.BaseDataUpload.OnSubmit(EditContext context) in /home/jenkins/workspace/AP-AssetAudit-QAS/BootstrapBlazorApp.Shared/Pages/PC/BaseDataUpload.razor.cs:line 118
   at BootstrapBlazor.Components.ValidateForm.<>c__DisplayClass56_0.<<OnValidSubmitForm>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__9_0>d.MoveNext()
--- End of stack trace from previous location ---
   at BootstrapBlazor.Components.ValidateForm.<>c__DisplayClass56_0.<<OnValidSubmitForm>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at BootstrapBlazor.Components.ValidateForm.OnValidSubmitForm(EditContext context)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

可以看出OpenReadStream默认限制了大小,调整字节大小即可

posted @ 2021-06-18 13:46  Cody&  阅读(599)  评论(0)    收藏  举报