static void Main(string[] args) { if (!Environment.UserInteractive) { var ind = new ServiceS(); ServiceBase.Run(ind); } else { oVpnConnetion vpn = new oVpnConnetion(); Console.Read(); vpn.Disconnect(); } }
protected override void OnStop() { vpn.Disconnect(); base.OnStop(); }