473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to start Windows services from C# code

I got below function from http://techinterviewquestion.blogspot.com/
blog. it is working fine. i used

public void StartService(string ServiceName)
{
ServiceController sc = new ServiceController(ServiceName);
if (sc != null && sc.Status == ServiceControllerStatus.Stopped)
{

sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running);

}
}
Jul 31 '08 #1
4 1390
"nivedita" <Ni**********@gmail.comwrote in message
news:a6**********************************@r35g2000 prm.googlegroups.com...
I got below function from http://techinterviewquestion.blogspot.com/
blog. it is working fine. i used
This is the ASP.NET newsgroup - do you have an issue with ASP.NET...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 31 '08 #2
re:
!do you have an issue with ASP.NET...?

Nah. He's spamming this newsgroup.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message news:e3**************@TK2MSFTNGP05.phx.gbl...
"nivedita" <Ni**********@gmail.comwrote in message
news:a6**********************************@r35g2000 prm.googlegroups.com...
>I got below function from http://techinterviewquestion.blogspot.com/
blog. it is working fine. i used

This is the ASP.NET newsgroup - do you have an issue with ASP.NET...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 31 '08 #3
HI,

As mark said not a asp.net related.. but yet...

check out this.

http://www.dotnetspider.com/resource...ogrammati.aspx

Might help you!

Best of luck

Munna
Jul 31 '08 #4
Yep ... she is spamming! .. checked her other posts... totally
spamming!
Jul 31 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bryan | last post by:
We created a Windows Service with C#. The service will start OK on computers that are a member of a domain, but when we try to start it on a server that is configured for a workgroup we get the...
2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
29
by: Ken Allen | last post by:
I have a number of services developed in C# (.Net), and they have been working fine for the most part. Recently someone reported that ipon occassion (originally rarely, but more frequently on some...
3
by: SenthilVel | last post by:
Hi All i do need to control my windows services using aspx pages. I used the System.ServiceProcess.ServiceController namespace .... this is working fine when i run my code in a windows...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
5
by: SiD` | last post by:
when starting a windows service writte in vb.net, a messagebox appears: cannot start service from the command line or a debugger. A windows service must first be installed using installutil.exe ...
6
by: Arnie | last post by:
We're using the ServiceController class provided by the .NET Framework, programming in C#. We are using the Start() method to start a service from another service. This works fine most of the...
17
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
3
by: illegal.prime | last post by:
Hi all, I have a service that needs to start a regular windows application. I'm running the service as ServiceAccount.LocalSystem. But, when it starts the process (using Process.Start) the GUI...
1
by: aj | last post by:
A few service stop/start/restart questions on SQL Server 2005 SP2, which I'll call SQLS. It looks as if there are *potentially* 6 ways to start/stop SQLS Services like the engine itself,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.