Solved

Windows Service

Posted on 2004-04-08
5
335 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Disable Security Alert  popup in Winforms  embedded webbrowser. 1 81
C# Gridview 1 64
Need to sort columns in DataGridView 4 36
Converting PHP triple des decrypt to c# 9 62
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

735 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