Skip UseFileServer when wwwroot is missing.

Local Aspire has no published client folder; the middleware warned on every boot.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 13:22:28 +03:00
co-authored by Cursor
parent 782a56eefe
commit e35b8e438c
5 changed files with 81 additions and 1 deletions
+5 -1
View File
@@ -159,7 +159,11 @@ app.Map("/ws/game", async (HttpContext context, GameSocketHandler handler, Sessi
app.MapDefaultEndpoints();
// In a published container the built client lands in wwwroot next to the server.
app.UseFileServer();
// Local Aspire has no such folder — Vite serves the UI, and UseFileServer would warn.
if (ClientStaticFiles.CanServe(app.Environment.WebRootPath))
{
app.UseFileServer();
}
app.Run();