发布:2020/11/13 11:52:03作者:管理员 来源:本站 浏览次数:1564
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
© Copyright 2014 - 2025 柏港建站平台 ejk5.com. 渝ICP备16000791号-4