Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'

I get this below error message on Blazor server app when I try to send images over 50KB

Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'

I am using a richtext box and when I paste an image on it over 50KB I am getting this error. The error is happening on Blazor.server.js. This issue must be related to the data limit that can be send over web socket however even after I update this limit to larger size, I still see this issue.

This is my startup file code where I have modified the limit.

 app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapBlazorHub(options =>
                {
                    **options.ApplicationMaxBufferSize = 10 * 1024 * 1024;
                    options.TransportMaxBufferSize = 10 * 1024 * 1024;**
                });
                endpoints.MapFallbackToPage("/_Host");
            });

The error is happening on blazer.server.js and the connection is getting dropped eachtime it is happening. Has any one faced this issue with Blazor server enter image description here

like image 443
csensoft Avatar asked Feb 20 '20 01:02

csensoft


People also ask

What is the shared connection to server closed error?

We are here for you] To conclude, the Shared connection to server closed error occur when we run an Ansible command to execute commands on two newly deployed CentOS 8 servers. PREVENT YOUR SERVER FROM CRASHING!

Why did my SignalR connection close?

Transient network failures may close the SignalR connection. The server may interpret the closed connection as a graceful client disconnect. To get more info on why a client disconnected in those cases gather logs from the client and server.

Why did my hubname connection fail?

Returns a 404. WebSocket connection to 'wss://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 400 Error: Failed to start the connection: Error: There was an error with the transport. This error is usually caused by a client using only the WebSockets transport but the WebSocket protocol isn't enabled on the server.

Why did the connection to the remote system fail?

Our Support Techs found that the connection failed because the shell (s) in the remote system could not find the Python interpreter. After checking the remote hosts, we found that the systems do not have Python 2 installed.


Video Answer


1 Answers

I have increased the size for Singal R and that fixed the issue for now but this is not a proper solution.

services.AddSignalR(e => {
                e.MaximumReceiveMessageSize = 102400000;
            });

The proper solution is to implement your own hub between client and server and process in chunks and stick it together.

refer to : https://learn.microsoft.com/en-us/aspnet/core/signalr/streaming?view=aspnetcore-3.1

like image 82
csensoft Avatar answered Oct 19 '22 20:10

csensoft