A small problem getting my service to work

  • Thread starter Thread starter Simon Harvey
  • Start date Start date
S

Simon Harvey

Hi chaps,

I've made a pretty simple service in c# using VS.net. It compiles correctly
and I've followed what little documentation there is to create a setup
project in order to install the service.

When I try to do the install, everything seems to go well apart from right
at the end, it asks me for a account name and a password.

I'm not sure what to give it. I've tried my own account and I've tried
making an entirely new account just for this purpose but it doesnt work
either.

Does anyone know what its wanting? Is there any way I can even get it to
stop asking altogether?

Thanks

Simon
 
/// This shows how to define a specific user account to be used for the
Service
/// (in ProjectInstaller.cs file)

private void InitializeComponent()
{
this.serviceProcessInstaller1 = new
System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.User;
this.serviceProcessInstaller1.Password = "myPswd";
this.serviceProcessInstaller1.Username = Environment.MachineName +
@"\myServiceAccount";
//
// serviceInstaller1
...




/// Or you can use the local System account to run your service. With this
account, you are
/// a priviledged user for your local machine but can hardly access remote
ressources

private void InitializeComponent()
{
this.serviceProcessInstaller1 = new
System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.LocalSystem;
//
// serviceInstaller1
.......



By the way, there is a nice article about Service at:
http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=32


José
 
Back
Top