29 lines
677 B
C#
29 lines
677 B
C#
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
var services = builder.Services;
|
|
services.AddControllers();
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
services.AddEndpointsApiExplorer();
|
|
services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
var webSocketOptions = new WebSocketOptions()
|
|
{
|
|
KeepAliveInterval = TimeSpan.FromSeconds(120),
|
|
};
|
|
|
|
app.UseWebSockets(webSocketOptions);
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseAuthorization();
|
|
app.MapControllers();
|
|
app.Run(); |