(opt =>
var app = builder.Build();
app.UseRouting();
-app.UseAuthentication();
-app.UseAuthorization();
+
+// Config WebSocket support.
+app.UseWebSocketHandoffMiddleware();
app.UseWebSockets(new WebSocketOptions
{
KeepAliveInterval = TimeSpan.FromSeconds(60),
KeepAliveTimeout = TimeSpan.FromSeconds(300),
});
+
+// Configure identity control
+app.UseAuthentication();
+app.UseAuthorization();
+
+// Configure actual controllers
app.MapControllers();
-// Configure the HTTP request pipeline.
+// Configure fallback endpoints
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
app.UseSwagger();
app.UseSwaggerUI();
+ app.MapGet("/", () => Results.Redirect("/swagger/index.html"));
}
+else
+{
+ app.MapGet("/", () => "Please use client app to open this server.
");
+}
+
app.Run();