IHostingEnvironment Interface

Provides information about the web hosting environment an application is running in.

Namespace
Microsoft.AspNetCore.Hosting
Assemblies
  • Microsoft.AspNetCore.Hosting.Abstractions

Syntax

public interface IHostingEnvironment
interface Microsoft.AspNetCore.Hosting.IHostingEnvironment

Properties

Microsoft.AspNetCore.Hosting.IHostingEnvironment.ApplicationName

Gets or sets the name of the application. This property is automatically set by the host to the assembly containing the application entry point.

Return type:System.String
string ApplicationName { get; set; }
Microsoft.AspNetCore.Hosting.IHostingEnvironment.ContentRootFileProvider

Gets or sets an Microsoft.Extensions.FileProviders.IFileProvider pointing at Microsoft.AspNetCore.Hosting.IHostingEnvironment.ContentRootPath.

Return type:Microsoft.Extensions.FileProviders.IFileProvider
IFileProvider ContentRootFileProvider { get; set; }
Microsoft.AspNetCore.Hosting.IHostingEnvironment.ContentRootPath

Gets or sets the absolute path to the directory that contains the application content files.

Return type:System.String
string ContentRootPath { get; set; }
Microsoft.AspNetCore.Hosting.IHostingEnvironment.EnvironmentName

Gets or sets the name of the environment. This property is automatically set by the host to the value of the “ASPNETCORE_ENVIRONMENT” environment variable.

Return type:System.String
string EnvironmentName { get; set; }
Microsoft.AspNetCore.Hosting.IHostingEnvironment.WebRootFileProvider

Gets or sets an Microsoft.Extensions.FileProviders.IFileProvider pointing at Microsoft.AspNetCore.Hosting.IHostingEnvironment.WebRootPath.

Return type:Microsoft.Extensions.FileProviders.IFileProvider
IFileProvider WebRootFileProvider { get; set; }
Microsoft.AspNetCore.Hosting.IHostingEnvironment.WebRootPath

Gets or sets the absolute path to the directory that contains the web-servable application content files.

Return type:System.String
string WebRootPath { get; set; }