Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows Service

Posted on 2004-04-08
5
Medium Priority
?
344 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
5 Comments
 
LVL 12

Assisted Solution

by:dfiala13
dfiala13 earned 200 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 1600 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 200 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline

971 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