IHostingEnvironment 介面

定義

警告

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

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

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

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.AspNetCore.Hosting.IWebHostEnvironment.", false)]
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.AspNetCore.Hosting.IWebHostEnvironment.", false)>]
type IHostingEnvironment = interface
Public Interface IHostingEnvironment
屬性

屬性

ApplicationName
已淘汰.

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

ContentRootFileProvider
已淘汰.

取得或設定指向 ContentRootPathIFileProvider

ContentRootPath
已淘汰.

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

EnvironmentName
已淘汰.

取得或設定環境的名稱。 主機會自動將此屬性設定為 「ASPNETCORE_ENVIRONMENT」 環境變數的值,或任何其他組態來源中指定的 「environment」。

WebRootFileProvider
已淘汰.

取得或設定指向 WebRootPathIFileProvider

WebRootPath
已淘汰.

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

擴充方法

IsDevelopment(IHostingEnvironment)
已淘汰.

檢查目前的主控環境名稱是否為 Development

IsEnvironment(IHostingEnvironment, String)
已淘汰.

比較目前主控環境名稱與指定的值。

IsProduction(IHostingEnvironment)
已淘汰.

檢查目前的主控環境名稱是否為 Production

IsStaging(IHostingEnvironment)
已淘汰.

檢查目前的主控環境名稱是否為 Staging

適用於