Tim B
Tim B

Reputation: 193

Service wont deploy on server

Trying to Install a service onto a server, currently running under .Net Framework 2.0 . When I run the .MSI file from the setup project everything is copied over however when I check under the SMC, the service is not there. Also, when I try to use InstallUtil to install the service I'm prompted with No public installers with the RunInstallerAtrribute.Yes attribute could be found in the assembly. When I check my ProjectInstaller.cs everything looks ok. Also, I'm able to install fine on my computer and I have admin privileges on both the server and my box.

Here is the ProjectInstaller.cs file

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;


namespace MyService
{
    [RunInstaller(true)]
    public partial class ProjectInstaller : Installer
    {
        public ProjectInstaller()
        {
            InitializeComponent();
        }
    }
}

Edit: Server is currently running Windows 2003 R2 Service pack two. Personal computer is running Windows 7 and Visual Studios 2010

Upvotes: 0

Views: 64

Answers (1)

Paul Keister
Paul Keister

Reputation: 13077

Here's a sample of some code that installs a service:

[RunInstaller(true)]
public class InstallMyService : Installer
{
    public InstallMyService()
    {
        var svc = new ServiceInstaller();

        svc.ServiceName = "MyService";
        svc.Description = "This is a service";
        svc.DisplayName = "My Service";
        svc.StartType = ServiceStartMode.Automatic;

        var svcContext = new ServiceProcessInstaller();
        svcContext.Account = ServiceAccount.LocalSystem;

        Installers.Add(svc);
        Installers.Add(svcContext);
    }
}

Upvotes: 1

Related Questions