In a C# 2008 desktop application, I am finding that there are processes that are not released once when the application finishes executing.
Every time this application runs, there are more processes that are not released. I want to mention this application was originally written as a console application, but was changed to a windows application since I did not want all the dos popup windows.
I do want to mention that in this application the following is not occuring:
1. When some of the objects are created, there is no dispose on the objects.
2. Some of the linq statements do not have a using clause on them.
What kind of code could be causing this problem?
Thus can you tell me, point me to a reference, and/or show me code on how to reolve this problem?
When looking on the internet, it looks like profiler is only in the premium and standard edition of .net. My company is using the professional version.
Is there another tool that you are aware of that I could use?
var sc = new System.ServiceProcess.ServiceController("ELSRegressionService");
Its working fine, when logged in with Administrator credentials. If I login with other user credentials, it throws exception, "Cannot open Servicexxx service on computer 'COMPUTER_NAME'"
I would like to ask for credentials before the user tries to start service. So please guide me to check for credentials to start windows service programmatically. Thanks in advance
If you need administrator privilege only for starting the service, you could delay request for elevation till you need it. This can be done by starting a new process and setting ProcessStartInfo.Verb[^] to runas. This new process can execute the code to start/stop the service. You need the new process because you can't change elevation levels of the current process while it is running.