Today we tried installing a .Net windows service (a scheduler service) on a Windows 2000 Advanced Server box. The service used to run on a Windows XP box and was working perfectly fine. But since our target machine was Windows 2000, we had to migrate it to such.
Then, bam! The windows service just wouldn't install. We have tried recompiling it on the target machine, then install (using installutil.exe). Still, to no avail.
The first error we encountered was:
System.ComponentModel.Win32Exception: The account name is invalid
or does not exist, or the password is invalid for the account name
specified
The original configuration of the service was to use the Local Service account. We decided to change it to Local System. The service installed successfully.
But when we tried starting the service, we got a new error:
The service could not be started.
The service did not report an error.
Now there's a very 'descriptive' error message...Not!
I've tried looking at the Event Log but nothing really could help us out in diagnosing this problem.
Evaluating the situation, we now know that our windows service is installed, but it just would not start. And the error message could not really help us in moving forward to solving the problem.
At last I decided to use the third Account Type option - to run as it User.
this.serviceProcessInstaller1.Account =System.ServiceProcess.ServiceAccount.User;
Remember that for the Username property, we must indicate it in the format:
Domain\username.
I did not know beforehand that it was supposed to be that way. LOL! I kept using just the user name.
I created a new user account on the windows 2000 box with just enough permissions to run our windows service.
The installation using installutil.exe went smoothly. And lo and behold, the service started successfully! Phew!
I do not have a really in-depth knowledge of developing and deploying windows service. I am glad that we have solved this problem.
I don't know how come the service would not install when using the Local Service account under windows 2000 nor do I know how to solve the error occuring when I attempt to start the service after successfully installing it using the Local System account type.
Any ideas?
No comments:
Post a Comment