Solved

Windows Service

Posted on 2004-04-08
5
332 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:knowlton
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:knowlton
ID: 10787183
actually....I have the uninstall and install running in a batch file......works pretty fast.
0
 
LVL 5

Author Comment

by: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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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