How can I restart a windows service programmatically in .NET? Also, I need to do an operation when the service restart is completed.
Call Environment.Exit with an error code greater than 0, which seems appropriate, then on install we configure the service to restart on error.
Environment.Exit
Environment.Exit(1);
I have done same thing in my Service. It is working fine.