JulianusIV
JulianusIV
Explore posts from servers
CC#
Created by JulianusIV on 2/7/2023 in #help
✅ Blocking ASP.NET Core Shutdown fully
When i shut down my ASP.NET Core API i have to make 0-n API requests and receive (and answer) that many api requests myself, so i have to block the host shutdown until that is completed. I have tried to use the WebApplication.Lifetime.ApplicationStopped CancellationToken, and subscribed the Register event to block the thread until i got all requests or until a timeout, but the requests end up with a 502, which usually happens when the API is down, so id guess the shutdown of the whole app is blocked, but the controllers still dont get routed to anymore. Does someone know how i can achieve something like this?
17 replies