blitzkriegz
blitzkriegz

Reputation: 9576

Installing .NET Windows Service

I'm trying to install the first service I wrote using:

installutil XMPPMonitor.exe

I get the following message:

Running a transacted installation.

Beginning the Install phase of the installation.
See the contents of the log file for the E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.exe assembly's progress.
The file is located at E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.InstallLog.

The Install phase completed successfully, and the Commit phase is beginning.
See the contents of the log file for the E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.exe assembly's progress.
The file is located at E:\Documents\Projects\XMPPMonitor\XMPPMonitor\bin\Debug\XMPPMonitor.InstallLog.

The Commit phase completed successfully.


The transacted install has completed.

But I'm not setting the service listed when I run services.msc. Am I missing something?

Upvotes: 5

Views: 10712

Answers (4)

Cheeso
Cheeso

Reputation: 192657

can we see the code?

What do you have for the Description attribute? Have you clicked F5 (Refresh) in the Services MMC?

public class WindowsServiceInstallerEx : ServiceInstaller
{

  [ComponentModel.Description("A lengthy description of the service that will display in the Description column of the Services MMC applet.")]
  public string ServiceDescription
  {
    get { return serviceDescription; }
    set { serviceDescription = value; }
  }

  public override void Install(System.Collections.IDictionary stateSaver)
  {
    base.Install (stateSaver);

    Microsoft.Win32.RegistryKey serviceKey = null;
    try
    {
      string strKey = string.Format(@"System\CurrentControlSet\Services\{0}", this.ServiceName);

      serviceKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strKey, true);
      serviceKey.SetValue("Description", this.ServiceDescription);
    }
    finally
    {
      if (serviceKey != null)
        serviceKey.Close();
    }
  }

  private string serviceDescription;
}

Upvotes: 1

Andreas Grech
Andreas Grech

Reputation: 108040

I asked a similar question recently : C#: Running and Debugging a Windows Service

Apparently the problem was because I did not have an Installer attached to the service.

Here is the tutorial I used to add a Service Installer and so on.

Upvotes: 3

SwDevMan81
SwDevMan81

Reputation: 50028

You might need to refresh the services.msc window, sometimes it doesnt update it if you have it open all the time. Hit F5 to refresh to the window and see if its there.

Upvotes: 1

Reed Copsey
Reed Copsey

Reputation: 564871

Make sure you correctly created and configured the ServiceInstaller and ServiceProcessInstaller. These are what installutil uses to actually register each service within the process.

Upvotes: 5

Related Questions