Exemple #1
0
        protected override IHost CreateWebHost()
        {
            ContentRoot = FindSampleOrTestSitePath(
                typeof(TProgram).Assembly.FullName);

            var host = "127.0.0.1";

            if (E2ETestOptions.Instance.SauceTest)
            {
                host = E2ETestOptions.Instance.Sauce.HostName;
            }

            var args = new List <string>
            {
                "--urls", $"http://{host}:0",
                "--contentroot", ContentRoot,
                "--pathbase", PathBase,
                "--applicationpath", typeof(TProgram).Assembly.Location,
            };

            if (!string.IsNullOrEmpty(Environment))
            {
                args.Add("--environment");
                args.Add(Environment);
            }

            return(DevHostServerProgram.BuildWebHost(args.ToArray()));
        }
        protected override IHost CreateWebHost()
        {
            if (TestTrimmedApps)
            {
                var staticFilePath = Path.Combine(AppContext.BaseDirectory, "trimmed", typeof(TProgram).Assembly.GetName().Name);
                if (!Directory.Exists(staticFilePath))
                {
                    throw new DirectoryNotFoundException($"Test is configured to use trimmed outputs, but trimmed outputs were not found in {staticFilePath}.");
                }

                return(CreateStaticWebHost(staticFilePath));
            }

            ContentRoot = FindSampleOrTestSitePath(
                typeof(TProgram).Assembly.FullName);

            var host = "127.0.0.1";

            var args = new List <string>
            {
                "--urls", $"http://{host}:0",
                "--contentroot", ContentRoot,
                "--pathbase", PathBase,
                "--applicationpath", typeof(TProgram).Assembly.Location,
            };

            if (!string.IsNullOrEmpty(Environment))
            {
                args.Add("--environment");
                args.Add(Environment);
            }

            return(DevHostServerProgram.BuildWebHost(args.ToArray()));
        }
Exemple #3
0
 static int Main(string[] args)
 {
     DevServerProgram.BuildWebHost(args).Run();
     return(0);
 }
Exemple #4
0
 private int Execute()
 {
     DevServerProgram.BuildWebHost(RemainingArguments.ToArray()).Run();
     return(0);
 }