Я не могу запустить свой веб-сайт при попытке настроить Kestrel с помощью промежуточного программного обеспечения UseKestrel
в ASP.NET Core 2.2 (работает на Windows 10).
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
return new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
var env = hostingContext.HostingEnvironment;
config.SetBasePath(env.ContentRootPath);
config.AddInMemoryCollection(new[]
{
new KeyValuePair<string,string>("the-key", "the-value")
})
.AddJsonFile("appsettings.json", reloadOnChange: true, optional: false)
.AddJsonFile($"appsettings.{env}.json", optional: true)
.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, logging) =>
{
logging.AddDebug();
logging.AddConsole();
})
.UseIISIntegration()
.UseDefaultServiceProvider((context, options) =>
{
options.ValidateScopes = context.HostingEnvironment.IsDevelopment();
})
.UseStartup<Startup>();
}
Я не получилошибка, но мой сайт не загружается.