IHostingEnvironment 介面

定義

警告

This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostEnvironment.

警告

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

提供應用程式執行所在的主控環境相關資訊。

此類型已淘汰,將會在未來的版本中移除。 建議的替代類型是 Microsoft.Extensions.Hosting.IHostEnvironment。

public interface class IHostingEnvironment
public interface IHostingEnvironment
[System.Obsolete("This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostEnvironment.", false)]
public interface IHostingEnvironment
[System.Obsolete("IHostingEnvironment has been deprecated. Use Microsoft.Extensions.Hosting.IHostEnvironment instead.")]
public interface IHostingEnvironment
type IHostingEnvironment = interface
[<System.Obsolete("This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.Extensions.Hosting.IHostEnvironment.", false)>]
type IHostingEnvironment = interface
[<System.Obsolete("IHostingEnvironment has been deprecated. Use Microsoft.Extensions.Hosting.IHostEnvironment instead.")>]
type IHostingEnvironment = interface
Public Interface IHostingEnvironment
衍生
屬性

屬性

ApplicationName
已淘汰.
已淘汰.

取得或設定應用程式的名稱。 主機會自動將此屬性設定為包含應用程式進入點的組件。

ContentRootFileProvider
已淘汰.
已淘汰.

取得或設定指向 ContentRootPathIFileProvider

ContentRootPath
已淘汰.
已淘汰.

取得或設定包含應用程式內容檔案的目錄絕對路徑。

EnvironmentName
已淘汰.
已淘汰.

取得或設定環境的名稱。 主機會自動將此屬性設定為組態中指定的 "environment" 索引鍵值。

擴充方法

IsDevelopment(IHostingEnvironment)
已淘汰.
已淘汰.

檢查目前的主控環境名稱是否為 Development。 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。

IsEnvironment(IHostingEnvironment, String)
已淘汰.
已淘汰.

比較目前主控環境名稱與指定的值。 程式庫作者應避免使用此 API,如需詳細資料,請參閱備註。

IsProduction(IHostingEnvironment)
已淘汰.
已淘汰.

檢查目前的主控環境名稱是否為 Production。 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。

IsStaging(IHostingEnvironment)
已淘汰.
已淘汰.

檢查目前的主控環境名稱是否為 Staging。 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。

適用於