I'm writing a Blazor server side application for ETL. I have a form with 8 fields, one of which is a textarea created with <InputTextArea>
. This field is used to cut-and-paste the contents of data from spreadsheets, CSV files, HTML tables, etc.
The OnValidSubmit
for the <EditForm>
is wired to a ProcessForm()
function in the @code {}
section of the .razor
file.
Everything works fine as long as the string in the textarea is less than 20,798 characters. When I paste 20,798 or more characters into the control, however, there is a pause on submission (the contents of the browser become disabled) then the message An error has occurred. This application may no longer respond until reloaded. Reload"
appears in the footer of the viewport. I'm developing in VS Code, and nothing appears in the terminal window (or any other console window), including the logging statement at the very beginning of my ProcessForm()
method. However, the message Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'
does appear on the JS console of the browser.
I've seen references to maximum buffer lengths in the underlying SignalR technology, but none of the methods I saw in older posts for setting a larger buffer appear compatible with new .MapBlazorHub
method of configuring Blazor (and, in any event, I would like to be able to handle arbitrarily large amounts of data).
Does anyone know how I can increase, or remove, the data-size limit in this scenario?
I guess this is what you need. 32kb is the default as far as I can recall.
services
.AddServerSideBlazor()
.AddHubOptions(options => { options.MaximumReceiveMessageSize = 32 * 1024; });