31 lines
570 B
C#
31 lines
570 B
C#
|
using Microsoft.AspNetCore.Http.Connections;
|
||
|
|
||
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
||
|
builder.Services.AddRazorPages();
|
||
|
builder.Services.AddSignalR();
|
||
|
|
||
|
var app = builder.Build();
|
||
|
|
||
|
if (!app.Environment.IsDevelopment())
|
||
|
{
|
||
|
app.UseExceptionHandler("/Error");
|
||
|
app.UseHsts();
|
||
|
}
|
||
|
|
||
|
app.UseHttpsRedirection();
|
||
|
app.UseStaticFiles();
|
||
|
|
||
|
app.UseRouting();
|
||
|
|
||
|
app.UseAuthorization();
|
||
|
|
||
|
app.MapRazorPages();
|
||
|
app.MapHub<ChatHub>("/chathub", options =>
|
||
|
{
|
||
|
options.Transports =
|
||
|
HttpTransportType.WebSockets |
|
||
|
HttpTransportType.LongPolling;
|
||
|
}
|
||
|
);
|
||
|
app.Run();
|