Cannot start Service on a server configured as a member of a workgroup

B

Bryan

We created a Windows Service with C#. The service will start OK on
computers that are a member of a domain, but when we try to start it on a
server that is configured for a workgroup we get the following error in the
event log:

Event ID: 7001
Description: The {Service Name}service depends on the Net Logon service
which failed to start because of the following error:
The service has returned a service-specific error code.

When checking the Net Logon service, we noticed that it did not start
because of the following error in the event log:

Event ID: 3095
Description: This Windows NT computer is configured as a member of a
workgroup, not as a member of a domain. The Netlogon service does not need
to run in this configuration.

Does this mean we can't run .NET Services on any box that is not a member of
a domain?.. I sure hope not!..

Please, please, please someone give me a fix for this.

Thanks,
Bryan
 
J

Jeffrey Wynn

Bryan,

Without knowing more about your service and how it is setup, I don't have a
fix for the situation. I can tell you, however, that a computer running as
a member of a workgroup can indeed run .NET Windows services. We have built
many at my company.

Please send details concerning your service.
 
B

Bryan

Well, to eliminate anything stupid we might be doing, we created an empty
service. From "New Project", I selected "Visual C# Projects" and chose
"Windows Service". After the wizard created the service I just added a
"Project Installer" and compiled it. When I tried to run it on the box that
is not a member of the domain, we got the exact same error.

Is there anything you can suggest?..

Thanks for any help!
Bryan
 
B

Bryan

Ok, here is the deal... It will work if you set the
serviceProcessInstaller's account set to "LocalSystem". If you have it set
to user, the service will install, but it cannot be started. We are
suspecting that is why it is trying to use the NetLogon service.

The fix we came up with was to set the account to "User", and in the
ProjectInstaller.cs, we added the following code in the
InitializeComponent() function:

String ComputerName = "";
try
{
RegistryKey rkey =
Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Comput
erName\\ComputerName");
ComputerName = (String)rkey.GetValue("ComputerName", "unknown");
} catch(Exception e) {
System.Console.WriteLine("Error retrieving Computer Name from local
registry. " + e.Message);
}

this.serviceProcessInstaller1 = new
System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account =
System.ServiceProcess.ServiceAccount.User;
this.serviceProcessInstaller1.Password = "somepassword";
this.serviceProcessInstaller1.Username = ComputerName + "\\someusername";

We ran into issues between Windows NT and Windows 2000 that is why we are
having to use the local computer name... Using \\computername worked on
Windows 2000, but did not work on Windows NT. Using the physical computer
name solved the problem.
 

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