Introduction:
Here I will explain how to install windows service and how to start the windows service in our local machine.
If we want to uninstall the installed windows service you just point to your service same as what I explained previously and type statement installutil /u and your service name
Here I will explain how to install windows service and how to start the windows service in our local machine.
Description:
In previous article I explained clearly how to create windows service and how to run windows service in scheduled intervals. Now I will explain how to install windows service in our system.
In previous article I explained clearly how to create windows service and how to run windows service in scheduled intervals. Now I will explain how to install windows service in our system.
To install windows service in your follow these steps
Start --> All Programs --> Microsoft Visual Studio 2008 --> Visual Studio Tools --> Open Visual Studio Command Prompt
After open command prompt point to your windowsservice.exe file in your project
Initially in our command prompt we are able to see path like this
C:\Program Files\ Microsoft Visual Studio 9.0\VC >
This path is relating to our visual studio installation path because during installation if you give different path this path should be different now we can move to folder which contains our windowsservice.exe file. After moving to exe file exists path my command prompt like this
After moving to our windowsservice.exe contains folder now type
Installutil windowsservicesample.exe (Give your windows service exe file name) and now press enter button.
After type Installutil windowsservicesample.exe file that would be like this
After that the service will install successfully in your system.
Now I have question do you have idea on how to see installed windows services and how to start our windows service if you have idea good otherwise no need to panic just follow below steps
Start --> Control Panel --> Open Control Panel --> Select Administrative Tools --> Computer Management --> Services and Applications --> Services --> Open services
Now check for your windows service name and right click on that and select option start your windows service has started successfully
That would be like this
Installutil /u windowsservicesample.exe
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
60 comments :
That's too Good Suresh...
Thanks dude
Excellent Blog...
Hi Suresh it shows error by the time of installing :exception occur during rollback phase of installation
hi,
i think that problem because of permissions problem. Please check the error message in your command prompt and try it
ok sure I will check that.
Actully first time I am working on windows service so dont no in depth but your artical is very informative for like me (beginners):)
thanks again
Simple ,yet efficient blog really good article for understanding
Very nice Tutorial.It help me too Much.But i Didnt understand something here.Can u tell me abt OnElapsedTime function here.Cant we write whole code in timer_tick event.,
Hi..I have problem in installing the window service
when i type the command installutil myservicename.exe in command prompt than error is coming
so pls suggest me..
hello sir,
your tutorial was really helped me alot .can u tell me how can use windows service with Wpf application? plz share some link thnx
sumit
The Rollback phase completed successfully.
The transacted install has completed.
The installation failed, and the rollback has been performed.
plz suggest me for above instation failling
thanks
hello suresh
The Rollback phase completed successfully.
The transacted install has completed.
The installation failed, and the rollback has been performed.
plz suggest me for above instation failling
thanks
@Suhail..
i think that problem because of login details please check do you have admin rights to install windows service or not and give your system username and password during install windows service correctly
thank u sir for your valuable responce ur tutarial is very helpful .the problem was due to account type, now the problem is i have made an installer for the servie.the service works good for mannually. but i want start it automatically when service instal and stop when service uninstall
thanks
Can any help me in this issue.. i got c# program which should do accordingly
The installer should have the following when launched
Ask the user to enter
1. company URL
2. User ID
3. Password
Once the validation is complete, it should store the company URL in a properties file, which has to be picked up by the service to send information to our server.
4. The user should have the option to stop my service from the system tray and start - programs
Thank u. Your tutorial is so helpful. Thanks again for your tutorial.
Hello Suresh,
Excellent tutorial. Please need some help for Starting the Service. I get:
"Windows could not start the SchedulledService Service on Local Computer. Error 5: Access denied"
This happens in W7 and also with XP. I opened the cmd box and the Service window as Admin (Run as Administrator).
Appreciante a hint
Thanks
Xavier
hi suresh, i did step by step but while installing WS in VS2010 in does not install. it give error 'installation failed,rollback performed'
can you solve my query plz
Hi suresh,
it was really a nice article.
i also want to know that how can i connect window service to my database using app.config and then make an exe setup for my window service
thanks
Hi Suresh,
After done with installation ,I wanted to start windows service and followed the steps as you said. But, I'm not able to find my windows service name in Services !!
What might have gone wrong? Please help.
Regards,
Pallavi
hello suresh can u tell me how to install service in server system where it is in cloud and we dont have vs prompt over there, how to install using general command prompt
Thanx.. It's working...
Thanks a lot Suresh Bhai...
thanx suresh
...........HELP HELP HELP HELP............
I am getting message while installing Windows Service. Message is " ACCESS IS DENIED"
Please help
Thanx in advance
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the E:\work Area\WinServiceSample\WinServic
eSample\bin\Debug\WinServiceSample.exe assembly's progress.
The file is located at E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\
WinServiceSample.InstallLog.
Installing assembly 'E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\Wi
nServiceSample.exe'.
Affected parameters are:
logtoconsole =
logfile = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinService
Sample.InstallLog
assemblypath = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinSe
rviceSample.exe
Installing service ScheduledService...
Creating EventLog source ScheduledService in log Application...
An exception occurred during the Install phase.
System.Security.SecurityException: The source was not found, but some or all eve
nt logs could not be searched. Inaccessible logs: Security.
The Rollback phase of the installation is beginning.
See the contents of the log file for the E:\work Area\WinServiceSample\WinServic
eSample\bin\Debug\WinServiceSample.exe assembly's progress.
The file is located at E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\
WinServiceSample.InstallLog.
Rolling back assembly 'E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\
WinServiceSample.exe'.
Affected parameters are:
logtoconsole =
logfile = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinService
Sample.InstallLog
assemblypath = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinSe
rviceSample.exe
Restoring event log to previous state for source ScheduledService.
An exception occurred during the Rollback phase of the System.Diagnostics.EventL
ogInstaller installer.
System.Security.SecurityException: The source was not found, but some or all eve
nt logs could not be searched. Inaccessible logs: Security.
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.
The Rollback phase completed successfully.
The transacted install has completed.
The installation failed, and the rollback has been performed.
i am getting above error while installing services..
i am also getting above error and also tried to installutil.exe in the directory where my webservice allready is, but getting same error...
Thanks Suresh..Today I learn a lot from you. please continue to share gud things with us.
same error as above.please help
Please help with the error of transaction being rollbakc.i have given full control.stil issue persists...Help asap...plzz
Really super suresh.....
@Upendra Patel and @JITENDRA YADAV,
Try to run the Open "Visual Studio Command Prompt" with admin mode, re-run the InstallUtil command & see if you are still seeing that error.
Hi Suresh,
I'm getting an error while installing the .exe file into my local machine.
ERROR:'installutil' is not recognized as an internal or external command,
operable program or batch file.
Plz help me out in fixing this bug.
Thank you
hi suresh,
The service is not installed, because i didnt create setup for it, Can u explain how to create setup ?
sir,
please tell me can it applicable on hosting site if yes then how?
how can we solve this error?
C:\sakthi\DemoService\DemoService\bin\Debug>installutil DemoService.exe
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the C:\sakthi\DemoService\DemoService\bin\D
ebug\DemoService.exe assembly's progress.
The file is located at C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.I
nstallLog.
Installing assembly 'C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.exe
'.
Affected parameters are:
logtoconsole =
logfile = C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.InstallLog
assemblypath = C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.exe
An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: Access is denied
The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\sakthi\DemoService\DemoService\bin\D
ebug\DemoService.exe assembly's progress.
The file is located at C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.I
nstallLog.
Rolling back assembly 'C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.e
xe'.
Affected parameters are:
logtoconsole =
logfile = C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.InstallLog
assemblypath = C:\sakthi\DemoService\DemoService\bin\Debug\DemoService.exe
An exception occurred during the Rollback phase of the System.ServiceProcess.Ser
viceProcessInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.
The Rollback phase completed successfully.
The transacted install has completed.
The installation failed, and the rollback has been performed.
After successful completion of services it cannot be appeared in services menu...
please tell me the solution...
'Documents' is not recognized as an internal or external command,
operable program or batch file. can you tell me what;s the probleam
nice articl
it is not getting Install in local Machine Will u please help me suresh
I tried this in windows 7 64 bit machine with Run as administrator option , i am getting this error :
An exception occurred during the Install phase.
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security. The Rollback phase completed successfully.
other servers this is working fine, do we have to change any settings to install this in windows 7 server
while you are running in command prompt run the cmd as administrator then u will not face th problems of roll back issue
choose the Account type as the User type then give your system credentials and u can run the service
hi Suresh.. your article is really so useful but I am getting problem while installing the window service. it gives the error of unrecognized internal and external command. please help
Very Useful
I am getting an issue in installation -- I ran the command prompt in admin mode and ran the below command
C:\WinService Sample\WinService Sample\bin\debug>installutil WinService Sample.exe
I am getting Error -- 'installutil' is not recognized as an internal or external command, operable program or batch file
PLEASE HELP --- I have installutil on my machine under :\WINDOWS\Microsoft.NET\Framework\v4.0.30319
Hi man,
How to install on any one user account with write permissions on event log.I am getting security related exception are System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.
Hello to everyone,
Who getting security base error, please run you command prompt in run as administrative mode.It solve issue.
Thanks
Thank you Suresh....very nyc article. Keep writing such articles.
For checking the running status of ur service, u can also simply write services.msc on 'Run' and search ur service.
Thank u so much This s amazing man.
Thanks for providing this solution.
i runned Visual studio command prompt as Administrator and it works successfully.
Hi,
I am also getting same issue. I ran as administrator but still getting same problem. Please help me.
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the E:\work Area\WinServiceSample\WinServic
eSample\bin\Debug\WinServiceSample.exe assembly's progress.
The file is located at E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\
WinServiceSample.InstallLog.
Installing assembly 'E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\Wi
nServiceSample.exe'.
Affected parameters are:
logtoconsole =
logfile = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinService
Sample.InstallLog
assemblypath = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinSe
rviceSample.exe
Installing service ScheduledService...
Creating EventLog source ScheduledService in log Application...
An exception occurred during the Install phase.
System.Security.SecurityException: The source was not found, but some or all eve
nt logs could not be searched. Inaccessible logs: Security.
The Rollback phase of the installation is beginning.
See the contents of the log file for the E:\work Area\WinServiceSample\WinServic
eSample\bin\Debug\WinServiceSample.exe assembly's progress.
The file is located at E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\
WinServiceSample.InstallLog.
Rolling back assembly 'E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\
WinServiceSample.exe'.
Affected parameters are:
logtoconsole =
logfile = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinService
Sample.InstallLog
assemblypath = E:\work Area\WinServiceSample\WinServiceSample\bin\Debug\WinSe
rviceSample.exe
Restoring event log to previous state for source ScheduledService.
An exception occurred during the Rollback phase of the System.Diagnostics.EventL
ogInstaller installer.
System.Security.SecurityException: The source was not found, but some or all eve
nt logs could not be searched. Inaccessible logs: Security.
An exception occurred during the Rollback phase of the installation. This except
ion will be ignored and the rollback will continue. However, the machine might n
ot fully revert to its initial state after the rollback is complete.
The Rollback phase completed successfully.
The transacted install has completed.
The installation failed, and the rollback has been performed.
When i clicked on start i got this dialog box.. " The scheduledService service on local computer started and then stopped. some service stop automatically if they are not in use by other services or program ". I am new with the topic.. Please help..
Exellent Work! Keep it up
good explanation..............thankz
Try to install with CMD (Run as Administrators) at system32 folder.
Good It was really helpful. Thanks
jkl
Note: Only a member of this blog may post a comment.