is there any installer to install the windows service

naresh

Active member
Joined
Jul 4, 2006
Messages
38
Programming Experience
1-3
Hi,
this Question is already raised. Still i am asking this one is there any installer to install the windows service. I use Setup factory to install the applications. can i use the setup factory to instll. if yes please suggest the way to install. the service was made in .net 2005 i,e., frame work 2.0.

thanks in advance.
 
I don't know about setup factory, but you can certainly deploy a windows service from a .MSI using the setup projects in VS. Or in your case, because you are using .Net 2.0 you might be able to use 'Click Once'
 
I've tried Click Once for Windows Services and I havn't been successful. Then again I'm not a guru at Windows Services. The problem I was getting is that it installed but then tried to run it right away, gave me an error saying it needed be installed via blah blah and then on next boot nothing. The service never worked. Of course I could have screwed somthing up myself but I don't think click once is working for Windows Services.
 
No, ClickOnce doesn't work for Windows Services. But does your service work at all? You need to get yourself familiar with Installutil.exe, there is one in \Windows\Microsoft.Net\Framework\-yourversion-\, and this is the only tool that installs services. After the service is installed with InstallUtil.exe it can be started in Services console from Control Panel.
 
Good to know. No, my service never worked and that would be why. I have another question though, when I use Installutil.exe is this a redistributable way of having others install it as well? I want to destribute this service.
 
With the MSI installers you can do Custom Actions. Some make the service install after setup with registry keys, some with coding execution of InstallUtil (which is installed in advance by prerequisite .Net Framework!), but the easiest with VS setup project is simply to add an custom action for project output for install+uninstall actions where you set the argument to respectively "/install" and "/uninstall" (this invokes InstallUtil without user interaction). See screenshot, it's from VS2003, but could be similar for VS2005.

In case you missed another point, the service project need two components also, the ServiceInstaller and the ServiceProcessInstaller, configured in a class that inherits System.Configuration.Install.Installer class. Without this the InstallUtil.exe will fail with some error message about no installers found. I've previously posted these classes for use with VS2005 Express here http://www.vbdotnetforums.com/showpost.php?p=30791&postcount=2

Anyway, while debugging there is no need to build the setup, run the setup, uninstall the setup all the time. Since the only way to debug a windows service is to install it and start it and stop it and uninstall it, you'll be doing this all the time. It's much easier to have a Command window up where you have typed the two commands 'installutil -i service.exe' and 'installutil -u service.exe', where 'service.exe' is the project build output. Then it's just a matter of uparrow-enter/downarrow-enter to repeat the commands.

Also, this whole discussion about the extra step with InstallUtil is not a big issue, Windows Services is not something that is installed/uninstalled every day, not every year even, and it is usually handled by competent computer professionals. It is a rarely applied project type, and when people do make a windows service the first thing done is breaking the base intension about a windows service - ie, making it interact with user desktop... which usually means the project should not have been implemented as a service in the first place. I'm perhaps talking a bit over myself here, times do change, it's not only NT servers with administrators in charge that runs services anymore, but any desktop XP OS with ~erhm~ ordinary users.

Well, the screenshot should display just below here now..:
 

Attachments

  • serviceinstaller.JPG
    serviceinstaller.JPG
    68.8 KB · Views: 193
Hey ImDaFrEaK, I have another option for this

I used batch file to install and uninstall the windows service in the remote system. I will attach both the install and uninstall batch files. Please edit the file and change the service.exe name to your exe name. and place the batch file where ur exe is located. try to run it. it solves ur problem.
 

Attachments

  • seviceUnInstall.zip
    836 bytes · Views: 64
Thank you all for your help very much. I feel like before I use any of these that I actually need to get a detailed book or site and see what exactly is going on so I can better understand the situation. That way I can not only asnwer this question for others in the future but explain it as well. Thank you guys again I will most likely review each of your answers.
 
Ok, I am probably killing this topic but I am still pretty lost. I need to build a program (there is no UI) that starts whenever the user logs onto windows. I need this service to run with all users. I also need this service to be destributable. For example, I can give you the setup.exe and you can install it on your system. I have tried to grasp this topic and it appears that I am a dumb fart. I just don't understand the process. If possible please show a really simple coding example of a service. I really appreciate any more help I can recieve on doing this on top of the tons of help I have already recieved.
 
I am starting to think I don't need a Windows Service. What I need is for my program to start when the user logs on. The best answers online I could find were to edit the registry and with the Project Installer in VS2005 you can add keys ect to the registry during installation. But I don't know what to add. Can anyone give a tip on this? Does anyone have a program that runs everytime the user logs on for the first time and not when windows is booting? I just need some guidance and sample code maybe. Any advice about the registry would be helpful too b/c I know nothing about the registry.

BTW JohnH; that link helped me understand Windows Services tons better. I read nearly every link that site posted on every topic. I do not have 100% understanding or maybe even 50% on the topic but it helped alot.
 
That may very well be, Windows Service is not a common application type, and often misused by beginners. There is nothing wrong with having regular desktop app run for longer periods of time, for example throughout the user session, the most common of these are the so called 'tray applications' that most of time you see only as an icon in system tray (and that may or may not also have forms UI).

My.Computer.Registry give easy access to registry for VB.Net. Some info about registry here, and lots of registry tutorials in general. In registry hives currentuser or localmachine there is the branch '\SOFTWARE\Microsoft\Windows\CurrentVersion' with keys 'Run' and 'RunOnce' that can be used.

Else you can add a shortcut to users Startup group in startmenu that starts each login. The SpecialFolder enumeration Startup member can also be used to find this folder.
 
well said

well said. I would like to know where the windows service is used and what are the advantages of using it.

for example: My system is getting one browser automatically whenever the system starts. when i close that browser window after 5 minutes again the browser windows is coming. I thought of using windows service to kill that process. is it the right way to use? It is also solved by the windows application.

Thanks
Naresh
 
Read the Introduction to Windows Service Applications.

In general (and in your case) a Windows Service is not appropriate if it needs to interact with user desktop session, at least if the need of a service is still there it should be paired with a desktop application that handles the user desktop and takes care of communication with the service. There has been much talk about the infamous service setting 'allow to interact with desktop' will no longer be possible in Windows Vista, but it doesn't seem clear to me. Also some info about this in Interactive Services page.
 
Back
Top