diff --git a/src/TaxBaik.Web/Program.cs b/src/TaxBaik.Web/Program.cs index fa8734e..9360f9a 100644 --- a/src/TaxBaik.Web/Program.cs +++ b/src/TaxBaik.Web/Program.cs @@ -407,30 +407,13 @@ app.MapFallbackToFile("portal/{*path:nonfile}", "portal/index.html"); try { Log.Information("애플리케이션 시작: {Environment}", app.Environment.EnvironmentName); - app.Run(); + await app.RunAsync(); } catch (Exception ex) { Log.Fatal(ex, "애플리케이션 강종"); - if (!app.Environment.IsDevelopment()) - { - try - { - var fatalMessage = $"환경: {app.Environment.EnvironmentName}\n오류: {ex.Message}"; - if (TaxBaik.Web.Services.TelegramAlertGate.ShouldSend("telegram:fatal", fatalMessage, TimeSpan.FromMinutes(30))) - { - using var scope = app.Services.CreateScope(); - var telegramService = scope.ServiceProvider.GetRequiredService(); - await telegramService.SendErrorAsync( - "❌ 서버 오류", - fatalMessage); - } - } - catch (Exception telegramEx) - { - Log.Error(telegramEx, "오류 알림 전송 실패"); - } - } + // NOTE: RunAsync() 후 app.Services는 dispose됨. + // Telegram 알림은 별도 모니터링 백그라운드 작업으로 처리 throw; } finally