IHostingEnvironment 介面
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
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 |
已淘汰.
已淘汰.
取得或設定指向 ContentRootPath 的 IFileProvider。 |
ContentRootPath |
已淘汰.
已淘汰.
取得或設定包含應用程式內容檔案的目錄絕對路徑。 |
EnvironmentName |
已淘汰.
已淘汰.
取得或設定環境的名稱。 主機會自動將此屬性設定為組態中指定的 "environment" 索引鍵值。 |
擴充方法
IsDevelopment(IHostingEnvironment) |
已淘汰.
已淘汰.
檢查目前的主控環境名稱是否為 Development。 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。 |
IsEnvironment(IHostingEnvironment, String) |
已淘汰.
已淘汰.
比較目前主控環境名稱與指定的值。 程式庫作者應避免使用此 API,如需詳細資料,請參閱備註。 |
IsProduction(IHostingEnvironment) |
已淘汰.
已淘汰.
檢查目前的主控環境名稱是否為 Production。 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。 |
IsStaging(IHostingEnvironment) |
已淘汰.
已淘汰.
檢查目前的主控環境名稱是否為 Staging。 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。 |
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應