EDN Admin
Well-known member
Hi Experts.
We have wirtten a service in C#. And we are writing following code in OnStart()
<span style="font-size:small
<pre class="prettyprint eventLog1.WriteEntry("my service started");
String command = @"C:IDSstart_lbq";
//Thread.Sleep(60000);
ProcessStartInfo ProcessInfo;
Process process;
ProcessInfo = new ProcessStartInfo("cmd", "/c " + command);
ProcessInfo.Verb = "runas";
ProcessInfo.Arguments = "/env /user:" + "Administrator" + " cmd" + command;
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = true;
// *** Redirect the output ***
ProcessInfo.RedirectStandardError = true;
ProcessInfo.RedirectStandardOutput = true;
process = Process.Start(ProcessInfo);
process.WaitForExit();[/code]
<br/>
<span style="font-size:small When we are starting this service it shows the status
Starting. I think it should show Started. I know that it is showinf starting because control is not coming out from OnStart() because of
process.WaitForExit(); in code snippet given above.
Will this Starting status going to efffect the Performance in long run.
Thanks in advance,
Sameer kariwal
View the full article
We have wirtten a service in C#. And we are writing following code in OnStart()
<span style="font-size:small
<pre class="prettyprint eventLog1.WriteEntry("my service started");
String command = @"C:IDSstart_lbq";
//Thread.Sleep(60000);
ProcessStartInfo ProcessInfo;
Process process;
ProcessInfo = new ProcessStartInfo("cmd", "/c " + command);
ProcessInfo.Verb = "runas";
ProcessInfo.Arguments = "/env /user:" + "Administrator" + " cmd" + command;
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = true;
// *** Redirect the output ***
ProcessInfo.RedirectStandardError = true;
ProcessInfo.RedirectStandardOutput = true;
process = Process.Start(ProcessInfo);
process.WaitForExit();[/code]
<br/>
<span style="font-size:small When we are starting this service it shows the status
Starting. I think it should show Started. I know that it is showinf starting because control is not coming out from OnStart() because of
process.WaitForExit(); in code snippet given above.
Will this Starting status going to efffect the Performance in long run.
Thanks in advance,
Sameer kariwal
View the full article