[RunInstaller(true)]
public sealed class Ins : SmartNetworkServiceInstaller
{
public Ins() : base("My Test Service", "http://+:80/yay", "https://+:443/yay") { }
}
class Program
{
static void Main(string[] args)
{
using (WinService service = new WinService())
{
if (Environment.UserInteractive)
{
// Startup as console app.
Controller.Run(service.ServiceName, new RunParameters(), args != null && args.Length == 1 ? args[0] : null);
}
else
{
// Startup as service.
// Use any or your services you want. The args is passed from Windows correctly and can be used.
ServiceBase.Run(service);
}
}
}
}
[RunInstaller(true)]
public sealed partial class ProjectInstaller : SimpleLocalSystemInstaller
{
public const string ServiceName = "My Test Service";
public ProjectInstaller() : base(ServiceName) { }
// Lets your service's startup to depend on some SQL instances already installed in the system.
protected override IEnumerable<string> EnumerateDependencies()
{
return base.EnumerateDependencies().Concat(ServiceHelper.GetInstalledMssqlServerInstances());
}
}