49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System.IO;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
using SocketsSample.Hubs;
|
|
|
|
namespace SocketsSample
|
|
{
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var config = new ConfigurationBuilder()
|
|
.AddCommandLine(args)
|
|
.Build();
|
|
|
|
var host = new WebHostBuilder()
|
|
.UseConfiguration(config)
|
|
.UseSetting(WebHostDefaults.PreventHostingStartupKey, "true")
|
|
.ConfigureLogging(factory =>
|
|
{
|
|
factory.AddConsole();
|
|
})
|
|
.UseKestrel(options =>
|
|
{
|
|
// Default port
|
|
options.ListenLocalhost(5000);
|
|
|
|
// Hub bound to TCP end point
|
|
options.ListenLocalhost(9001, builder =>
|
|
{
|
|
// Run the hub on this port (this won't work properly until streaming parsing is implemented)
|
|
builder.UseHub<Chat>();
|
|
});
|
|
})
|
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
.UseIISIntegration()
|
|
.UseStartup<Startup>()
|
|
.Build();
|
|
|
|
host.Run();
|
|
}
|
|
}
|
|
}
|