HostingAbstractionsWebHostBuilderExtensions.CaptureStartupErrors 方法

定義

設定是否應該在 Web 主機的組態設定中擷取啟動錯誤。 啟用時,將會攔截啟動例外狀況,並傳回錯誤頁面。 如果停用,則會傳播啟動例外狀況。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ CaptureStartupErrors(Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ hostBuilder, bool captureStartupErrors);
public static Microsoft.AspNetCore.Hosting.IWebHostBuilder CaptureStartupErrors (this Microsoft.AspNetCore.Hosting.IWebHostBuilder hostBuilder, bool captureStartupErrors);
static member CaptureStartupErrors : Microsoft.AspNetCore.Hosting.IWebHostBuilder * bool -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
<Extension()>
Public Function CaptureStartupErrors (hostBuilder As IWebHostBuilder, captureStartupErrors As Boolean) As IWebHostBuilder

參數

hostBuilder
IWebHostBuilder

要設定的 IWebHostBuilder

captureStartupErrors
Boolean

true 表示使用啟動錯誤頁面;否則為 false

傳回

IWebHostBuilder

IWebHostBuilder

適用於