Windows Service in C#

D

Dilip Krishnan

Ryan said:
I've written up a service in a C# using VS.NET to create the framework for
me. However, I can't seem to get the service installed properly. When I
run the InstallUtil on the service exe, it errors out, reporting the
following shortly after trying to create the event log:

An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: The account name is invalid or does
not exist, or the password is invalid for the account name specified

It then rolls back the installation. I've tried looking online for any
information about what could be causing this, but haven't come up with much.

Anyone out there have any ideas? Thanks a bunch.

Ryan Gregg
I believe your account would need to have access permissions
 
R

Ryan Gregg

I've written up a service in a C# using VS.NET to create the framework for
me. However, I can't seem to get the service installed properly. When I
run the InstallUtil on the service exe, it errors out, reporting the
following shortly after trying to create the event log:

An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: The account name is invalid or does
not exist, or the password is invalid for the account name specified

It then rolls back the installation. I've tried looking online for any
information about what could be causing this, but haven't come up with much.

Anyone out there have any ideas? Thanks a bunch.

Ryan Gregg
 
K

Ken Allen

Did you add a project installer 'class' to the project itself? If you
double-click on the main service source file then the [Design] page for the
service will be defined, and a right-click on this page will reveal a menu
that will contain an "Add Installer" entry; select this and a new source
file will be added to the project. Edit that file as required and rebuild
it.

-Ken
 
R

Ryan Gregg

Ken,

I already had a project installer, but I noticed when I was looking at it
again that I was using the "LocalService" account setting, instead of the
"LocalSystem" account. Since I don't beleive Windows 2000 has a
"LocalService" account setting, this is probably the cause of the problem.
After I swithed it over to LocalSystem, it seems to install and work
properly.

Thanks for your help.

Ryan Gregg


Ken Allen said:
Did you add a project installer 'class' to the project itself? If you
double-click on the main service source file then the [Design] page for the
service will be defined, and a right-click on this page will reveal a menu
that will contain an "Add Installer" entry; select this and a new source
file will be added to the project. Edit that file as required and rebuild
it.

-Ken

Ryan Gregg said:
I've written up a service in a C# using VS.NET to create the framework for
me. However, I can't seem to get the service installed properly. When I
run the InstallUtil on the service exe, it errors out, reporting the
following shortly after trying to create the event log:

An exception occurred during the Install phase.
System.ComponentModel.Win32Exception: The account name is invalid or does
not exist, or the password is invalid for the account name specified

It then rolls back the installation. I've tried looking online for any
information about what could be causing this, but haven't come up with much.

Anyone out there have any ideas? Thanks a bunch.

Ryan Gregg
 
R

Ryan Gregg

Well, I resolved this issue, but now I have another. I changed the service
over to run on the LocalSystem account, and that lets me install it
properly. However, when I try to actually start the service, I get the
following error:
 
R

Ryan Gregg

Arg. Let me try that again. I can install the service sucessfully now that
I'm using the LocalSystem account instead of LocalService.

However, when I try to start the service now, I get this error:

---------------------------
Microsoft Management Console
---------------------------
Could not start the TACS Runtime Service service on Local Computer.
The service did not return an error. This could be an internal Windows
error or an internal service error.
If the problem persists, contact your system administrator.

I've tried moving the service over to running as my user account to see if
there was a permissions issue involved there, and it still gives me the same
error. Is there any way to debug what is causing the service to fail to
start?

Thanks.
Ryan Gregg
 
T

Trebek

Ryan,

Is your service starting the application in an independent thread? As I'm
sure you know from the docs, a service has only 30 seconds to return from
the intial method call to be considered 'started'. Usually, you can just
start the service in an independent thread so it will return immediately.
If this is not the problem, post your service OnStart, Pause, etc... and I'm
sure people will help you.

Alex
 
R

Ryan Gregg

Alex,

Thanks for the response. Turns out there was a problem that my service was
missing it's .config file, and wasn't handleing the missing parameters in a
kind and gentle fashion. Fixing (read: adding) the error handling code
around reading from app.config as well as actually giving it a config file
solved my problems.

Thanks again.

Ryan Gregg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top