locked
How to set ApplicationMaxBufferSize for SignalR using Owin RRS feed

  • Question

  • User151220215 posted

    I see some posts on how to change default value of ApplicationMaxBufferSize for ASP.net Core, but not for ASP.net or OWIN.  

    I'm currently using Microsoft.AspNet.SignalR.Core ver 2.3 and Microsoft.Owin.SelfHost ver 4.0

    https://docs.microsoft.com/en-us/aspnet/core/signalr/configuration?view=aspnetcore-2.2
    This link shows me how to change it in aspnet Core.

    How do I change this value in Owin?  Here's my startup class.  I'm basically running into max message size issue and need to increase it.  I know it may cause performance problems but I have no other work around.

        class Startup {
            public void Configuration(IAppBuilder app) {
                var hubConfig = new HubConfiguration();
                var userProvider = new UserProvider();
    
                hubConfig.EnableDetailedErrors = true;
                GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => userProvider);
                GlobalHost.HubPipeline.AddModule(new ErrorHandlingPipelineModule());
    
                app.UseCors(CorsOptions.AllowAll);
                app.MapSignalR(hubConfig);
            }
        }

    Thursday, January 17, 2019 8:40 AM

Answers

  • User151220215 posted

    I found the solution.  It was quite easy with one line in the Startup class.  This removes the limit by setting it to null.  I know it's not best practice but this is an intranet app where I control the client code so I'm not worried since I only need large messages less than 1% of the time.  

    GlobalHost.Configuration.MaxIncomingWebSocketMessageSize = null;
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 17, 2019 6:43 PM