/// <summary> /// /// </summary> /// <param name="serviceDisplayName">null for using the assembly name.</param> /// <param name="serviceName">null for using the assembly name.</param> public EasyService(string serviceDisplayName = null, string serviceName = null) { var assemblyName = Assembly.GetEntryAssembly().GetName().Name; _serviceDisplayName = serviceDisplayName ?? assemblyName; serviceName = serviceName ?? assemblyName; _serviceManager = new WindowsServiceManager(_serviceDisplayName); _registryManipulator = new RegistryManipulator(serviceName); InternalService.OsStarted += Start; InternalService.OsStopped += Stop; ProjectInstaller.InitInstaller(_serviceDisplayName, serviceName); }
public MicroService(int port = 8081, string serviceDisplayName = null, string serviceName = null, Action <HttpConfiguration> configure = null, bool useCors = true) { _port = port; _configure = configure; _useCors = useCors; var assemblyName = Assembly.GetEntryAssembly().GetName().Name; _serviceDisplayName = serviceDisplayName ?? assemblyName; serviceName = serviceName ?? assemblyName; _serviceManager = new WindowsServiceManager(_serviceDisplayName); _registryManipulator = new RegistryManipulator(serviceName); InternalService.OsStarted += () => Start(_configure, _useCors); InternalService.OsStopped += Stop; ProjectInstaller.InitInstaller(_serviceDisplayName, serviceName); }
private void InitMicroService(string ipAddress, int port, string serviceDisplayName, string serviceName, Action <HttpConfiguration> configure, bool useCors) { _ipAddress = ipAddress; _port = port; _configure = configure; _useCors = useCors; var assemblyName = Assembly.GetEntryAssembly().GetName().Name; _serviceDisplayName = serviceDisplayName ?? assemblyName; serviceName = serviceName ?? assemblyName; _serviceManager = new WindowsServiceManager(_serviceDisplayName); _registryManipulator = new RegistryManipulator(serviceName); InternalService.OsStarted += () => Start(_configure, _useCors); InternalService.OsStopped += Stop; ProjectInstaller.InitInstaller(_serviceDisplayName, serviceName); }