コード例 #1
0
        public void Start()
        {
            Hostname = $"http://localhost:{GeneratePort()}";

            var hostBuilder = new KestrelHostBuilder();
            var builder     = hostBuilder.CreateHostBuilder(new string[] {}, Hostname, Path.Combine(Path.GetDirectoryName(typeof(KestrelHostBuilder).Assembly.Location), "..", "..", "..", "..", "BookShop.Mvc", "wwwroot"));

            _host = builder.Build();
            _host.StartAsync().ConfigureAwait(false);
        }
コード例 #2
0
        public void Start()
        {
            string location = typeof(KestrelHostBuilder).Assembly.Location;
            var    applicationAssemblyPath = Path.GetDirectoryName(location);

            if (applicationAssemblyPath is null)
            {
                throw new Exception("Location of application assembly could not be found");
            }

            string webRoot = Path.Combine(applicationAssemblyPath, "..", "..", "..", "..",
                                          "CommunityContentSubmissionPage", "wwwroot");

            var hostBuilder = new KestrelHostBuilder();
            var builder     = hostBuilder.CreateHostBuilder(new string[] { }, Hostname, webRoot);

            _host = builder.Build();
            _host.StartAsync().ConfigureAwait(false);
        }