HostingAbstractionsWebHostBuilderExtensions.CaptureStartupErrors(IWebHostBuilder, Boolean) 方法

定義

設定是否應在 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

適用於