IHostingEnvironment 接口

定义

注意

IHostingEnvironment has been deprecated. Use Microsoft.Extensions.Hosting.IHostEnvironment instead.

提供有关应用程序在其中运行的托管环境的信息。

此类型已过时,将在将来的版本中删除。 建议的替代方法是Microsoft。Extensions.Hosting.IHostEnvironment。

public interface class IHostingEnvironment
[System.Obsolete("IHostingEnvironment has been deprecated. Use Microsoft.Extensions.Hosting.IHostEnvironment instead.")]
public interface IHostingEnvironment
[<System.Obsolete("IHostingEnvironment has been deprecated. Use Microsoft.Extensions.Hosting.IHostEnvironment instead.")>]
type IHostingEnvironment = interface
Public Interface IHostingEnvironment
派生
属性

属性

名称 说明
ApplicationName
已过时.

获取或设置应用程序的名称。 此属性由主机自动设置为包含应用程序入口点的程序集。

ContentRootFileProvider
已过时.

获取或设置指向 IFileProviderContentRootPath.

ContentRootPath
已过时.

获取或设置包含应用程序内容文件的目录的绝对路径。

EnvironmentName
已过时.

获取或设置环境的名称。 主机自动将此属性设置为配置中指定的“environment”键的值。

扩展方法

名称 说明
IsDevelopment(IHostingEnvironment)
已过时.

检查当前托管环境名称是否为 Development

IsEnvironment(IHostingEnvironment, String)
已过时.

将当前托管环境名称与指定的值进行比较。

IsProduction(IHostingEnvironment)
已过时.

检查当前托管环境名称是否为 Production

IsStaging(IHostingEnvironment)
已过时.

检查当前托管环境名称是否为 Staging

适用于