Solved

Windows Service

Posted on 2004-04-08
5
337 Views
Last Modified: 2010-04-15
Everytime I build and deploy my windows service I have to redo the required username and password for it to run.

Is there anyway to supply these values programmatically so I don't have to keep typing them in?
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 12

Assisted Solution

by:dfiala13
dfiala13 earned 50 total points
ID: 10785728
Yes, I believe you can...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemserviceprocessserviceaccountclasstopic.asp

You need to build an installer app, but it lets you specificy the account to use when the service is installed.
0
 
LVL 9

Accepted Solution

by:
malharone earned 400 total points
ID: 10786038
This is how you'd do that...

Double click on your service to go to "design view" or select the YourServiceFile.cs file from Solution Explorer and press SHIFT+F7.
Go to View > Properties Window (F4).
The properties window'll have a link "Add Installer" to add installer.
Click the link and few moments later, .net IDE will have "ProjectInstaller.cs" file in the solution explorer.
This installer will have two components: "serviceProcessInstaller1" and "YOUR_SERVICE_NAME_Installer"
Right click on "serviceProcessInstaller1" and select Properties.
One of the properties for this object of type "ServiceProcessInstaller" is Account. This is an enumerated list containing "LocalService", "NetworkService", "LocalSystem" and "User". Select "User" from this drop-down.
Then you'll have to programmatically edit the "UserName" and "Password" properties for serviceProcessInstaller1 as neither username nor password are visible in propertie page.

hope this helps
0
 
LVL 5

Assisted Solution

by:AdrianJMartin
AdrianJMartin earned 50 total points
ID: 10787179
During Development -- Create the installer once and install it, set the password and username etc. But instead the uninstall/reinstall : Stop the service, and copy or move the executable( and other assemblies (dlls/exes)) from the Debug or Release folder to the programs install location Program Files->Company Name->application or whatever the installer is set to place it. Restart the service. Much quicker then unstalling and reinstalling.......
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 10787183
actually....I have the uninstall and install running in a batch file......works pretty fast.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 10806843
malharone:  Your suggestion worked just fine.  I no longer have to provide UserName and Password.....very nice.....that was getting a bit tedious.

Tom
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question