Пример #1
0
        private static void GoGoGo(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;

            var exePath       = Process.GetCurrentProcess().MainModule.FileName;
            var directoryPath = Path.GetDirectoryName(exePath);

            IWebHost host = new WebHostBuilder()
                            .UseKestrel()
                            .UseContentRoot(directoryPath)
                            .UseStartup <Startup>()
                            .UseUrls("http://+:4444")
                            .Build();

            if (Debugger.IsAttached || args.Contains("--debug") || Environment.UserInteractive)
            {
                host.RunAsApp();
            }
            else
            {
                host.RunAsService();
            }
        }