专业网站建设品牌,十四年专业建站经验,服务6000+客户--广州京杭网络
免费热线:400-683-0016      微信咨询  |  联系我们

c#SignalR一次发送最大数据量

当前位置:网站建设 > 技术支持
资料来源:网络整理       时间:2023/2/14 0:42:03       共计:3630 浏览

c# Signalr MessageSize默认是64K 大小,设为NULL即禁用这个限制 ,自己也可以按需求改为自己需要的大小

public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            //// 有关如何配置应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=316888
            ////设置可以跨域访问
            //app.UseCors (Microsoft.Owin.Cors.CorsOptions.AllowAll);
            ////映射到默认的管理
            ////var hubConfiguration = new HubConfiguration();
            ////hubConfiguration.EnableDetailedErrors = true;
            ////app.MapSignalR ("/signalr", hubConfiguration);
            //app.MapSignalR();

            app.Map("/signalr", map =>
            {
                // Setup the CORS middleware to run before SignalR.
                // By default this will allow all origins. You can
                // configure the set of origins and/or http verbs by
                // providing a cors options with a different policy.
                map.UseCors(CorsOptions.AllowAll);

                var hubConfiguration = new HubConfiguration
                {
                    EnableJSONP = true,
                    EnableJavaScriptProxies = true,
                    EnableDetailedErrors = true,

                    // You can enable JSONP by uncommenting line below.
                    // JSONP requests are insecure but some older browsers (and some
                    // versions of IE) require JSONP to work cross domain
                    // EnableJSONP = true
                };
                // Run the SignalR pipeline. We're not using MapSignalR
                // since this branch already runs under the "/signalr"
                // path.
                //最大数据量限制取消
                GlobalHost.Configuration.MaxIncomingWebSocketMessageSize = null;
                map.RunSignalR(hubConfiguration);
            });
        }
    }

默认数据缓冲区大小设置 GlobalHost.Configuration.DefaultMessageBufferSize = 1024

版权说明:
本网站凡注明“广州京杭 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
欢迎扫描右侧微信二维码与我们联系。
·上一条:C# Winform cilent call SignalR | ·下一条:利用SignalR来同步更新Winfrom小试

Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有    粤ICP备16019765号 

广州京杭网络科技有限公司 版权所有