How to get Task manager process closing events in c#?

Sachwet 1 Reputation point
2024-01-16T07:32:06.79+00:00

Hi Team
I am Implimenting a server(APIGatewat.exe which is console exe) to launch other console exe(act as other servers)  in background without 
user intercation mode
i am able to launch the exe(using process start) but when im closing my Main exe in background (like if exe get close in task manager or if it get close by other UI tool)
my other exe are not getting close when i use the cross mark in corner to close other exe also gets close for this im using event

            AppDomain.CurrentDomain.ProcessExit += new EventHandler(ProcessExitHandler);

anyone have idea how we can handle taskmanager process cloing events? or any other solution

Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | ASP.NET | ASP.NET API
Developer technologies | .NET | Other
Developer technologies | C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.