HostingAbstractionsWebHostBuilderExtensions Class¶
- Namespace
Microsoft.AspNetCore.Hosting
- Assemblies
- Microsoft.AspNetCore.Hosting.Abstractions
Syntax¶
public class HostingAbstractionsWebHostBuilderExtensions
-
class
Microsoft.AspNetCore.Hosting.
HostingAbstractionsWebHostBuilderExtensions
Methods¶
-
CaptureStartupErrors
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.Boolean)¶ Set whether startup errors should be captured in the configuration settings of the web host. When enabled, startup exceptions will be caught and an error page will be returned. If disabled, startup exceptions will be propagated.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - captureStartupErrors (System.Boolean) – <code>true</code> to use startup error page; otherwise <code>false</code>.
Return type: Returns: public static IWebHostBuilder CaptureStartupErrors(this IWebHostBuilder hostBuilder, bool captureStartupErrors)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
Start
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String[])¶ Start the web host and listen on the speficied urls.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to start. - urls (System.String<System.String>[]) – The urls the hosted application will listen on.
Return type: Returns: public static IWebHost Start(this IWebHostBuilder hostBuilder, params string[] urls)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseConfiguration
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, Microsoft.Extensions.Configuration.IConfiguration)¶ Use the given configuration settings on the web host.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - configuration (Microsoft.Extensions.Configuration.IConfiguration) – The
Microsoft.Extensions.Configuration.IConfiguration
containing settings to be used.
Return type: Returns: public static IWebHostBuilder UseConfiguration(this IWebHostBuilder hostBuilder, IConfiguration configuration)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseContentRoot
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)¶ Specify the content root directory to be used by the web host.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - contentRoot (System.String) – Path to root directory of the application.
Return type: Returns: public static IWebHostBuilder UseContentRoot(this IWebHostBuilder hostBuilder, string contentRoot)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseEnvironment
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)¶ Specify the environment to be used by the web host.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - environment (System.String) – The environment to host the application in.
Return type: Returns: public static IWebHostBuilder UseEnvironment(this IWebHostBuilder hostBuilder, string environment)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseServer
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, Microsoft.AspNetCore.Hosting.Server.IServer)¶ Specify the server to be used by the web host.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - server (Microsoft.AspNetCore.Hosting.Server.IServer) – The
Microsoft.AspNetCore.Hosting.Server.IServer
to be used.
Return type: Returns: public static IWebHostBuilder UseServer(this IWebHostBuilder hostBuilder, IServer server)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseStartup
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)¶ Specify the assembly containing the startup type to be used by the web host.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - startupAssemblyName (System.String) – The name of the assembly containing the startup type.
Return type: Returns: public static IWebHostBuilder UseStartup(this IWebHostBuilder hostBuilder, string startupAssemblyName)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseUrls
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String[])¶ Specify the urls the web host will listen on.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - urls (System.String<System.String>[]) – The urls the hosted application will listen on.
Return type: Returns: public static IWebHostBuilder UseUrls(this IWebHostBuilder hostBuilder, params string[] urls)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-
UseWebRoot
(Microsoft.AspNetCore.Hosting.IWebHostBuilder, System.String)¶ Specify the webroot directory to be used by the web host.
Arguments: - hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
Microsoft.AspNetCore.Hosting.IWebHostBuilder
to configure. - webRoot (System.String) – Path to the root directory used by the web server.
Return type: Returns: public static IWebHostBuilder UseWebRoot(this IWebHostBuilder hostBuilder, string webRoot)
- hostBuilder (Microsoft.AspNetCore.Hosting.IWebHostBuilder) – The
-