示例#1
0
        public static void Main(string[] args)
        {
            var webHostArgs = WebHostArgs.ParseArgs(args);

            if (webHostArgs == null)
            {
                return;
            }

            try
            {
                var handle = Process.GetCurrentProcess().MainWindowHandle;

                SetWindowText(handle, webHostArgs.Title);

                ConfigureWebConfig(webHostArgs);

                RunWebSite(webHostArgs);
                RunWebRole(webHostArgs);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToTraceMessage());
            }

            if (!webHostArgs.AllowSilentFail)
            {
                throw new InvalidOperationException(
                          string.Format(
                              CultureInfo.InvariantCulture,
                              "The web host {0} has exited unexpectedly",
                              webHostArgs.Title));
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            var webHostArgs = WebHostArgs.ParseArgs(args);

            if (webHostArgs == null)
            {
                return;
            }

            try
            {
                var handle = Process.GetCurrentProcess().MainWindowHandle;

                SetWindowText(handle, webHostArgs.Title);

                var host = WebHostFactory.Create(webHostArgs);

                host.Run(webHostArgs.Assembly,
                         webHostArgs.ConfigurationPath,
                         webHostArgs.ServiceDefinitionPath,
                         webHostArgs.RoleName,
                         webHostArgs.UseHostedStorage);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToTraceMessage());
            }

            if (!webHostArgs.AllowSilentFail)
            {
                throw new InvalidOperationException(
                          string.Format(
                              CultureInfo.InvariantCulture,
                              "The web host {0} has exited unexpectedly",
                              webHostArgs.Title));
            }
        }