I am getting the following error message:
Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error. InvalidDataException: The maximum message size of 36000B was exceeded. The message size can be configured in AddHubOptions.'.
Uncaught Error Error: Server returned an error on close: Connection closed with an error. InvalidDataException: The maximum message size of 36000B was exceeded. The message size can be configured in AddHubOptions.
Astute readers will notice that I already increased the maximum message size. I could increase it again, but that does not fix the problem. I want to know why the message is so large in the first place.
However I cannot track down exactly which message is triggering this message. In Chrome dev tools I can see the error in binary but not what caused it. I enabled more logging and that also gives me the error but not the source of the error.
How do I see exactly what is causing this large message?
CodePudding user response:
How do I see exactly what is causing this large message?
You can network trace by the way:
Collect a network trace with Fiddler
Install it from
For more info you can refer to Network traces
You can trace your web socket by wireshark
too. It's a sample video.
but that does not fix the problem Please
Please also try the following codes:
services.AddSignalR(o => {
o.MaximumReceiveMessageSize = null; // no limit
o.EnableDetailedErrors = true;
}).AddMessagePackProtocol();
services.Configure<HubOptions>(options =>
{
options.MaximumReceiveMessageSize = null;
});
public void Configure(IApplicationBuilder app, IHostEnvironment env)
{
....
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(routes => {
routes.MapHub<ChatHub>("/chatHub", options =>
{
options.ApplicationMaxBufferSize = 1024000;
// Set to 0 for no limit, or to some non-zero value (in bytes) to set a different buffer limit
options.TransportMaxBufferSize = 0;
});
});
app.UseMvc();
....
}