91 references to WebHostDefaults
Microsoft.AspNetCore (42)
ConfigureWebHostBuilder.cs (30)
42
var previousContentRootConfig = _configuration[
WebHostDefaults
.ContentRootKey];
44
var previousWebRootConfig = _configuration[
WebHostDefaults
.WebRootKey];
45
var previousApplication = _configuration[
WebHostDefaults
.ApplicationKey];
46
var previousEnvironment = _configuration[
WebHostDefaults
.EnvironmentKey];
47
var previousHostingStartupAssemblies = _configuration[
WebHostDefaults
.HostingStartupAssembliesKey];
48
var previousHostingStartupAssembliesExclude = _configuration[
WebHostDefaults
.HostingStartupExcludeAssembliesKey];
53
if (!string.Equals(previousWebRootConfig, _configuration[
WebHostDefaults
.WebRootKey], StringComparison.OrdinalIgnoreCase)
54
&& !string.Equals(HostingPathResolver.ResolvePath(previousWebRoot, previousContentRoot), HostingPathResolver.ResolvePath(_configuration[
WebHostDefaults
.WebRootKey], previousContentRoot), StringComparison.OrdinalIgnoreCase))
57
throw new NotSupportedException($"The web root changed from \"{HostingPathResolver.ResolvePath(previousWebRoot, previousContentRoot)}\" to \"{HostingPathResolver.ResolvePath(_configuration[
WebHostDefaults
.WebRootKey], previousContentRoot)}\". Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.");
59
else if (!string.Equals(previousApplication, _configuration[
WebHostDefaults
.ApplicationKey], StringComparison.OrdinalIgnoreCase))
62
throw new NotSupportedException($"The application name changed from \"{previousApplication}\" to \"{_configuration[
WebHostDefaults
.ApplicationKey]}\". Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.");
64
else if (!string.Equals(previousContentRootConfig, _configuration[
WebHostDefaults
.ContentRootKey], StringComparison.OrdinalIgnoreCase)
65
&& !string.Equals(previousContentRoot, HostingPathResolver.ResolvePath(_configuration[
WebHostDefaults
.ContentRootKey]), StringComparison.OrdinalIgnoreCase))
68
throw new NotSupportedException($"The content root changed from \"{previousContentRoot}\" to \"{HostingPathResolver.ResolvePath(_configuration[
WebHostDefaults
.ContentRootKey])}\". Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.");
70
else if (!string.Equals(previousEnvironment, _configuration[
WebHostDefaults
.EnvironmentKey], StringComparison.OrdinalIgnoreCase))
73
throw new NotSupportedException($"The environment changed from \"{previousEnvironment}\" to \"{_configuration[
WebHostDefaults
.EnvironmentKey]}\". Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.");
75
else if (!string.Equals(previousHostingStartupAssemblies, _configuration[
WebHostDefaults
.HostingStartupAssembliesKey], StringComparison.OrdinalIgnoreCase))
78
throw new NotSupportedException($"The hosting startup assemblies changed from \"{previousHostingStartupAssemblies}\" to \"{_configuration[
WebHostDefaults
.HostingStartupAssembliesKey]}\". Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.");
80
else if (!string.Equals(previousHostingStartupAssembliesExclude, _configuration[
WebHostDefaults
.HostingStartupExcludeAssembliesKey], StringComparison.OrdinalIgnoreCase))
83
throw new NotSupportedException($"The hosting startup assemblies exclude list changed from \"{previousHostingStartupAssembliesExclude}\" to \"{_configuration[
WebHostDefaults
.HostingStartupExcludeAssembliesKey]}\". Changing the host configuration using WebApplicationBuilder.WebHost is not supported. Use WebApplication.CreateBuilder(WebApplicationOptions) instead.");
120
var previousApplication = _configuration[
WebHostDefaults
.ApplicationKey];
121
var previousEnvironment = _configuration[
WebHostDefaults
.EnvironmentKey];
122
var previousHostingStartupAssemblies = _configuration[
WebHostDefaults
.HostingStartupAssembliesKey];
123
var previousHostingStartupAssembliesExclude = _configuration[
WebHostDefaults
.HostingStartupExcludeAssembliesKey];
125
if (string.Equals(key,
WebHostDefaults
.WebRootKey, StringComparison.OrdinalIgnoreCase) &&
131
else if (string.Equals(key,
WebHostDefaults
.ApplicationKey, StringComparison.OrdinalIgnoreCase) &&
137
else if (string.Equals(key,
WebHostDefaults
.ContentRootKey, StringComparison.OrdinalIgnoreCase) &&
143
else if (string.Equals(key,
WebHostDefaults
.EnvironmentKey, StringComparison.OrdinalIgnoreCase) &&
149
else if (string.Equals(key,
WebHostDefaults
.HostingStartupAssembliesKey, StringComparison.OrdinalIgnoreCase) &&
155
else if (string.Equals(key,
WebHostDefaults
.HostingStartupExcludeAssembliesKey, StringComparison.OrdinalIgnoreCase) &&
WebApplicationBuilder.cs (10)
54
new KeyValuePair<string, string?>(
WebHostDefaults
.WebRootKey, options.WebRootPath),
117
new KeyValuePair<string, string?>(
WebHostDefaults
.WebRootKey, options.WebRootPath),
172
new KeyValuePair<string, string?>(
WebHostDefaults
.WebRootKey, options.WebRootPath),
223
webHostBuilder.UseSetting(
WebHostDefaults
.ApplicationKey, _hostApplicationBuilder.Environment.ApplicationName ?? "");
224
webHostBuilder.UseSetting(
WebHostDefaults
.PreventHostingStartupKey, Configuration[
WebHostDefaults
.PreventHostingStartupKey]);
225
webHostBuilder.UseSetting(
WebHostDefaults
.HostingStartupAssembliesKey, Configuration[
WebHostDefaults
.HostingStartupAssembliesKey]);
226
webHostBuilder.UseSetting(
WebHostDefaults
.HostingStartupExcludeAssembliesKey, Configuration[
WebHostDefaults
.HostingStartupExcludeAssembliesKey]);
WebHost.cs (2)
109
builder.UseSetting(
WebHostDefaults
.ApplicationKey, applicationName);
163
if (string.IsNullOrEmpty(builder.GetSetting(
WebHostDefaults
.ContentRootKey)))
Microsoft.AspNetCore.Components.Endpoints (1)
DependencyInjection\DefaultRazorComponentsServiceOptionsConfiguration.cs (1)
24
var value = Configuration[
WebHostDefaults
.DetailedErrorsKey];
Microsoft.AspNetCore.Components.Server (1)
Circuits\CircuitOptionsJSInteropDetailedErrorsConfiguration.cs (1)
21
var value = Configuration[
WebHostDefaults
.DetailedErrorsKey];
Microsoft.AspNetCore.Hosting (36)
GenericHost\GenericWebHostBuilder.cs (4)
170
UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
195
UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
320
UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
345
UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
GenericHost\GenericWebHostService.cs (5)
71
var urls = Configuration[
WebHostDefaults
.ServerUrlsKey];
79
var httpPorts = Configuration[
WebHostDefaults
.HttpPortsKey] ?? string.Empty;
80
var httpsPorts = Configuration[
WebHostDefaults
.HttpsPortsKey] ?? string.Empty;
103
var preferHostingUrlsConfig = Configuration[
WebHostDefaults
.PreferHostingUrlsKey];
130
throw new InvalidOperationException($"No application configured. Please specify an application via IWebHostBuilder.UseStartup, IWebHostBuilder.Configure, or specifying the startup assembly via {nameof(
WebHostDefaults
.StartupAssemblyKey)} in the web host configuration.");
GenericHost\SlimWebHostBuilder.cs (1)
81
UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
Internal\WebHost.cs (3)
194
throw new InvalidOperationException($"No application configured. Please specify startup via IWebHostBuilder.UseStartup, IWebHostBuilder.Configure, injecting {nameof(IStartup)} or specifying the startup assembly via {nameof(
WebHostDefaults
.StartupAssemblyKey)} in the web host configuration.");
266
var urls = _config[
WebHostDefaults
.ServerUrlsKey] ?? _config[DeprecatedServerUrlsKey];
269
serverAddressesFeature!.PreferHostingUrls = WebHostUtilities.ParseBool(_config[
WebHostDefaults
.PreferHostingUrlsKey]);
Internal\WebHostOptions.cs (14)
20
ApplicationName = environment?.ApplicationName ?? GetConfig(
WebHostDefaults
.ApplicationKey) ?? Assembly.GetEntryAssembly()?.GetName().Name ?? string.Empty;
21
StartupAssembly = GetConfig(
WebHostDefaults
.StartupAssemblyKey);
22
DetailedErrors = WebHostUtilities.ParseBool(GetConfig(
WebHostDefaults
.DetailedErrorsKey));
23
CaptureStartupErrors = WebHostUtilities.ParseBool(GetConfig(
WebHostDefaults
.CaptureStartupErrorsKey));
24
Environment = environment?.EnvironmentName ?? GetConfig(
WebHostDefaults
.EnvironmentKey);
25
WebRoot = GetConfig(
WebHostDefaults
.WebRootKey);
26
ContentRootPath = environment?.ContentRootPath ?? GetConfig(
WebHostDefaults
.ContentRootKey);
27
PreventHostingStartup = WebHostUtilities.ParseBool(GetConfig(
WebHostDefaults
.PreventHostingStartupKey));
28
SuppressStatusMessages = WebHostUtilities.ParseBool(GetConfig(
WebHostDefaults
.SuppressStatusMessagesKey));
29
ServerUrls = GetConfig(
WebHostDefaults
.ServerUrlsKey);
30
PreferHostingUrls = WebHostUtilities.ParseBool(GetConfig(
WebHostDefaults
.PreferHostingUrlsKey));
33
HostingStartupAssemblies = Split(ApplicationName, GetConfig(
WebHostDefaults
.HostingStartupAssembliesKey));
34
HostingStartupExcludeAssemblies = Split(GetConfig(
WebHostDefaults
.HostingStartupExcludeAssembliesKey));
36
var timeout = GetConfig(
WebHostDefaults
.ShutdownTimeoutKey);
StaticWebAssets\StaticWebAssetsLoader.cs (1)
50
var candidate = configuration[
WebHostDefaults
.StaticWebAssetsKey] ?? ResolveRelativeToAssembly(environment);
WebHostBuilder.cs (4)
47
if (string.IsNullOrEmpty(GetSetting(
WebHostDefaults
.EnvironmentKey)))
50
UseSetting(
WebHostDefaults
.EnvironmentKey, Environment.GetEnvironmentVariable("Hosting:Environment")
54
if (string.IsNullOrEmpty(GetSetting(
WebHostDefaults
.ServerUrlsKey)))
57
UseSetting(
WebHostDefaults
.ServerUrlsKey, Environment.GetEnvironmentVariable("ASPNETCORE_SERVER.URLS"));
WebHostBuilderExtensions.cs (4)
43
hostBuilder.UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
72
hostBuilder.UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
102
hostBuilder.UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
145
hostBuilder.UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName);
Microsoft.AspNetCore.Hosting.Abstractions (10)
HostingAbstractionsWebHostBuilderExtensions.cs (10)
43
return hostBuilder.UseSetting(
WebHostDefaults
.CaptureStartupErrorsKey, captureStartupErrors ? "true" : "false");
58
.UseSetting(
WebHostDefaults
.ApplicationKey, startupAssemblyName)
59
.UseSetting(
WebHostDefaults
.StartupAssemblyKey, startupAssemblyName);
90
return hostBuilder.UseSetting(
WebHostDefaults
.EnvironmentKey, environment);
103
return hostBuilder.UseSetting(
WebHostDefaults
.ContentRootKey, contentRoot);
116
return hostBuilder.UseSetting(
WebHostDefaults
.WebRootKey, webRoot);
129
return hostBuilder.UseSetting(
WebHostDefaults
.ServerUrlsKey, string.Join(';', urls));
141
return hostBuilder.UseSetting(
WebHostDefaults
.PreferHostingUrlsKey, preferHostingUrls ? "true" : "false");
152
return hostBuilder.UseSetting(
WebHostDefaults
.SuppressStatusMessagesKey, suppressStatusMessages ? "true" : "false");
163
return hostBuilder.UseSetting(
WebHostDefaults
.ShutdownTimeoutKey, ((int)timeout.TotalSeconds).ToString(CultureInfo.InvariantCulture));
Microsoft.AspNetCore.Server.IISIntegration (1)
WebHostBuilderIISExtensions.cs (1)
84
hostBuilder.UseSetting(
WebHostDefaults
.ServerUrlsKey, address);