Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 8th, 2007, 11:29 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Autostart a Windows Service

I am making an installshield installer and install a service during the install using installutil.exe. I would like to make this service autostart when windows boots up, is this possible? If so, how?

I thought this was more of a .net topic than an installshield one.

Thanks,

James

Reply With Quote
  #2 (permalink)  
Old August 8th, 2007, 12:03 PM
Authorized User
 
Join Date: Sep 2004
Location: Edegem, Antwerpen, Belgium.
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Normally, when creating a windows service in .NET you use an ServiceInstaller to install the service. The ServiceInstaller contains a property named StartType (http://msdn2.microsoft.com/en-us/library/system.serviceprocess.serviceinstaller.starttype(v s.80).aspx). You can set this property to one of the ServiceStartMode values (http://msdn2.microsoft.com/en-us/library/system.serviceprocess.servicestartmode(VS.80).aspx ).

So in your case, you need to set it to Automatic which indicates that the service needs to be started automatically.

Hope this helps.

Greetz,

Geert

http://geertverhoeven.blogspot.com
Reply With Quote
  #3 (permalink)  
Old August 8th, 2007, 02:47 PM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Many thanks for your reply. It is one of our other developers that has worked on the service and I am responsible for making the installer.

I've been doing some research on how Windows Services work and am I right in thinking that the installutil.exe is how all services are installed onto Windows (it's not a case of placing an exe onto the hard drive as in an application?)?

If so, am I right in assuming that there aren't any parameters that can be passed into installutil.exe that can make it autostart and that the only way to do this is by setting the ServiceStartMode property to Automatic in .net?

Reply With Quote
  #4 (permalink)  
Old August 13th, 2007, 08:48 PM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In .NET you create a class that implements ServiceInstaller I believe and installutil looks for this when installing your service. In the ServiceInstaller, you specify the start type and so on. So you do not specify start type in the service but in the service installer. In other words you are correct, the installutil does not explicitly have an option to set the start mode.

Also installutil is used for installing .NET services onto a Win32 machine that supports services (WinNT/2k/XP/Vista). Installutil will not install C++ executables for example. See http://msdn2.microsoft.com/en-us/lib...95(vs.80).aspx for usage.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Impersonate with windows service for Service A/C vinod_yadav1919 C# 0 October 18th, 2008 02:29 PM
Windows service exarkuun General .NET 0 September 7th, 2007 10:19 AM
Windows Service everest C# 1 March 8th, 2007 01:10 PM
Accessing Windows service from a windows app sajid08 C# 1 October 6th, 2006 10:25 AM
Windows Service r_ganesh76 General .NET 4 January 11th, 2005 05:08 PM



All times are GMT -4. The time now is 10:55 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.