2
Answers

Regarding calling an application from windows service

Photo of venkatesh p

venkatesh p

17y
2.3k
1
hi to all, i am new to .Net Development. My requirement was executing an application whenever the service starts. i need to do it in C#. please help.i don't know how to do that . if u have any reference specify that also.
thanks in advance

Answers (2)

0
Photo of venkatesh p
NA 7 0 17y
thanks for your reply. i got it. but when i start the service "it shows some errors " please help me to rectify that. the errror was  service could not be started on this computer . since no timely fashion reply from service.
0
Photo of Scott Lysle
NA 28.5k 14.4m 17y
You can start by overriding the OnStart event for your service; in that code you can use Process.Start to kick on some other application (in the below example, I start internet explorer and pass it the URL for MSN as a argument so that whenever the service starts, it opens up MSN in an explorer window)
protected override void OnStart(string[] args) {  System.Diagnostics.Process.Start("iexplore.exe", "http://www.msn.com"); }   Process.Start accepts a couple of arguments, the first is the executable to launch (e.g., iexplore.exe in this example) and the second argument is any optional arguments that the executable may use (in this case, a URL).  Of course the executable can be any executable and may include a full path to that executable and the arguments to the executable are optional.