mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
HTTP-service (dotnet process) does not shut down on desktop-app exit/quit #435
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hlubovac on GitHub (Dec 19, 2019).
Originally assigned to: @GregorBiswanger on GitHub.
I noticed this on Mac. Whether I close or quit the desktop window, the HTTP service does not shut down.
Does the mechanism that I'm looking for exist and doesn't reliably function, or is it not there at all? Am I missing a part of configuration that relates? I don't believe that I have anything within my dotnet app that might be non-standard or in a way to preventing the backend console to die.
Thank you.
Hari
@kk-code-lab commented on GitHub (Dec 22, 2019):
I've had the same problem on linux net core v3.1 and solved it by using
OnClosedevent fromBrowserWindowobject.I injected
IHostApplicationLifetimeobject in theConfiguremethod and usedStopApplication()when browser window calledOnClosedevent.IHostApplicationLifetimeis new in net core 3.0, before it was calledIApplicationLifetime(ms doc)For example:
@hlubovac commented on GitHub (Dec 22, 2019):
Thank you very much. That works flawlessly.
Previously, I had HTTP services remaining active in the background, and growing in number over time (as I would keep re-launching the app) - so, that wouldn't have looked good long-term.
Happy holidays!