IApplicationBuilder 介面

定義

定義類別,提供設定應用程式要求管線的機制。

public interface class IApplicationBuilder
public interface IApplicationBuilder
type IApplicationBuilder = interface
Public Interface IApplicationBuilder
衍生

屬性

名稱 Description
ApplicationServices

取得或設定 IServiceProvider ,提供對應用程式服務容器的存取。

Properties

取得索引鍵/值集合,可用來在中間件之間共享數據。

ServerFeatures

取得應用程式伺服器提供的一組 HTTP 功能。

方法

名稱 Description
Build()

建置此應用程式用來處理 HTTP 要求的委派。

New()

創造一個 IApplicationBuilder 共享 PropertiesIApplicationBuilder的新 。

Use(Func<RequestDelegate,RequestDelegate>)

將中間件委派新增至應用程式的要求管線。

擴充方法

名稱 Description
Map(IApplicationBuilder, PathString, Action<IApplicationBuilder>)

根據指定要求路徑的相符專案,分支要求管線。 如果要求路徑以指定的路徑開頭,則會執行分支。

Map(IApplicationBuilder, PathString, Boolean, Action<IApplicationBuilder>)

根據指定要求路徑的相符專案,分支要求管線。 如果要求路徑以指定的路徑開頭,則會執行分支。

Map(IApplicationBuilder, String, Action<IApplicationBuilder>)

根據指定要求路徑的相符專案,分支要求管線。 如果要求路徑以指定的路徑開頭,則會執行分支。

MapWhen(IApplicationBuilder, Func<HttpContext,Boolean>, Action<IApplicationBuilder>)

根據指定述詞的結果,分支要求管線。

Run(IApplicationBuilder, RequestDelegate)

將終端中間件委派新增至應用程式的要求管線。

RunProxy(IApplicationBuilder, ProxyOptions)

將要求傳送至遠端伺服器,如選項中所指定

RunProxy(IApplicationBuilder)

將要求傳送至遠端伺服器,如選項中所指定

Use(IApplicationBuilder, Func<HttpContext,Func<Task>,Task>)

將內嵌定義的中間件委派新增至應用程式的要求管線。 如果你沒有呼叫下一個函式,就用 Run(IApplicationBuilder, RequestDelegate) inste。

建議使用 Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>) 以取得更好的效能,如下所示:

app.Use((context, next) =>
{
    return next(context);
});

Use(IApplicationBuilder, Func<HttpContext,RequestDelegate,Task>)

將內嵌定義的中間件委派新增至應用程式的要求管線。 如果你沒有呼叫下一個函式,就用 Run(IApplicationBuilder, RequestDelegate) inste。

UseAntiforgery(IApplicationBuilder)

將防偽中間件新增至管線。

UseAuthentication(IApplicationBuilder)

將 加入 AuthenticationMiddleware 指定的 IApplicationBuilder,從而啟用認證功能。

UseAuthorization(IApplicationBuilder)

將 加入 AuthorizationMiddleware 指定的 IApplicationBuilder,使授權功能得以實現。

當授權使用端點路由路由的資源時,這個呼叫必須出現在 和 app.UseRouting()app.UseEndpoints(...) 呼叫之間,中介軟體才能正常運作。

UseBlazorFrameworkFiles(IApplicationBuilder, PathString)

設定應用程式從路徑 pathPrefix提供 Blazor WebAssembly 框架檔案。 此路徑必須對應至參考的 Blazor WebAssembly 應用程式專案。

UseBlazorFrameworkFiles(IApplicationBuilder)

設定應用程式以從根路徑 「/」 提供 Blazor WebAssembly 架構檔案。

UseBrowserLink(IApplicationBuilder)

呼叫此方法以在應用程式中啟用 Browser Link。 它會註冊處理站方法,為每個要求建立 BrowserLinkMiddleware。

UseCertificateForwarding(IApplicationBuilder)

將中間件新增至管線,以尋找要求標頭中的憑證譯碼,並更新 HttpContext.Connection.ClientCertificate。

UseClaimsTransformation(IApplicationBuilder, ClaimsTransformationOptions)

將中介軟體加入 ClaimsTransformationMiddleware 指定的 IApplicationBuilder,以啟用理賠轉換功能。

UseClaimsTransformation(IApplicationBuilder, Func<ClaimsTransformationContext,Task<ClaimsPrincipal>>)

將中介軟體加入 ClaimsTransformationMiddleware 指定的 IApplicationBuilder,以啟用理賠轉換功能。

UseClaimsTransformation(IApplicationBuilder)

將中介軟體加入 ClaimsTransformationMiddleware 指定的 IApplicationBuilder,以啟用理賠轉換功能。

UseConcurrencyLimiter(IApplicationBuilder)
已淘汰.

新增 以 ConcurrencyLimiterMiddleware 限制同時執行的請求數量。

UseConnections(IApplicationBuilder, Action<ConnectionsRouteBuilder>)
已淘汰.

新增對 IApplicationBuilder 請求執行管線 ASP.NET Core連線處理器的支援。

這個方法已過時,未來版本將會移除。 建議的替代方案是在 Microsoft 內使用 MapConnectionHandler<TConnectionHandler>。AspNetCore.Builder.UseEndpoints(...)。

UseCookieAuthentication(IApplicationBuilder, CookieAuthenticationOptions)
已淘汰.
已淘汰.

UseCookieAuthentication 已過時。 使用 AddAuthentication() 設定 Cookie 驗證。ConfigureServices 中的 AddCookie。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseCookieAuthentication(IApplicationBuilder, CookieAuthenticationOptions)

CookieAuthenticationMiddleware 中介軟體加入指定的 IApplicationBuilder,使 Cookie 認證功能得以實現。

UseCookieAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseCookieAuthentication 已過時。 使用 AddAuthentication() 設定 Cookie 驗證。ConfigureServices 中的 AddCookie。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseCookiePolicy(IApplicationBuilder, CookiePolicyOptions)

CookiePolicyMiddleware 處理器加入指定的 IApplicationBuilder,使 Cookie 政策功能得以實現。

UseCookiePolicy(IApplicationBuilder)

CookiePolicyMiddleware 處理器加入指定的 IApplicationBuilder,使 Cookie 政策功能得以實現。

UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)

將 CORS 中間件新增至 Web 應用程式管線,以允許跨網域要求。

UseCors(IApplicationBuilder, String)

將 CORS 中間件新增至 Web 應用程式管線,以允許跨網域要求。

UseCors(IApplicationBuilder)

將 CORS 中間件新增至 Web 應用程式管線,以允許跨網域要求。

UseDatabaseErrorPage(IApplicationBuilder, DatabaseErrorPageOptions)
已淘汰.

從可使用 Entity Framework 移轉解析的管線擷取同步和異步資料庫相關例外狀況。 發生這些例外狀況時,會產生 HTML 回應,其中包含可能解決問題的動作詳細數據。

UseDatabaseErrorPage(IApplicationBuilder)
已淘汰.

從可使用 Entity Framework 移轉解析的管線擷取同步和異步資料庫相關例外狀況。 發生這些例外狀況時,會產生 HTML 回應,其中包含可能解決問題的動作詳細數據。

UseDefaultFiles(IApplicationBuilder, DefaultFilesOptions)

使用指定的選項啟用預設檔案對應

UseDefaultFiles(IApplicationBuilder, String)

啟用指定要求路徑的預設檔案對應

UseDefaultFiles(IApplicationBuilder)

在目前路徑上啟用預設檔案對應

UseDeveloperExceptionPage(IApplicationBuilder, DeveloperExceptionPageOptions)

從管線擷取同步與非同步 Exception 實例,並產生 HTML 錯誤回應。

UseDeveloperExceptionPage(IApplicationBuilder)

從管線擷取同步與非同步 Exception 實例,並產生 HTML 錯誤回應。

UseDirectoryBrowser(IApplicationBuilder, DirectoryBrowserOptions)

使用指定的選項啟用目錄流覽

UseDirectoryBrowser(IApplicationBuilder, String)

啟用指定要求路徑的目錄流覽

UseDirectoryBrowser(IApplicationBuilder)

在目前路徑上啟用目錄流覽

UseElmCapture(IApplicationBuilder)

啟用 Elm 日誌服務,可透過 ElmPageMiddleware.存取。

UseElmPage(IApplicationBuilder)

啟用由 ElmCaptureMiddleware.s 擷取的瀏覽日誌。

UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>)

在指定的 IApplicationBuilder 中介軟體中加入 Microsoft.AspNetCore.Routing.EndpointMiddleware 中介軟體,並由配置的 IEndpointRouteBuilder 建置 EndpointDataSource 實例。 Microsoft.AspNetCore.Routing.EndpointMiddleware 會執行與目前請求相關的 Endpoint

UseExceptionHandler(IApplicationBuilder, Action<IApplicationBuilder>)

將中間件新增至管線,以攔截例外狀況、記錄例外狀況,並在替代管線中重新執行要求。 如果回應已啟動,將不會重新執行要求。

UseExceptionHandler(IApplicationBuilder, ExceptionHandlerOptions)

將中間件新增至管線,以攔截例外狀況、記錄例外狀況,並在替代管線中重新執行要求。 如果回應已啟動,將不會重新執行要求。

UseExceptionHandler(IApplicationBuilder, String, Boolean)

將中間件新增至管線,以攔截例外狀況、記錄例外狀況、重設要求路徑,然後重新執行要求。 如果回應已啟動,將不會重新執行要求。

UseExceptionHandler(IApplicationBuilder, String)

將中間件新增至管線,以攔截例外狀況、記錄例外狀況、重設要求路徑,然後重新執行要求。 如果回應已啟動,將不會重新執行要求。

UseExceptionHandler(IApplicationBuilder)

將中間件新增至管線,以攔截例外狀況、記錄例外狀況,並在替代管線中重新執行要求。 如果回應已啟動,將不會重新執行要求。

UseFacebookAuthentication(IApplicationBuilder, FacebookOptions)
已淘汰.
已淘汰.

UseFacebookAuthentication 已過時。 使用 AddAuthentication() 設定 Facebook 驗證。ConfigureServices 中的 AddFacebook。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseFacebookAuthentication(IApplicationBuilder, FacebookOptions)

將中介軟體加入 FacebookMiddleware 指定的 IApplicationBuilder,使 Facebook 能具備認證功能。

UseFacebookAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseFacebookAuthentication 已過時。 使用 AddAuthentication() 設定 Facebook 驗證。ConfigureServices 中的 AddFacebook。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseFileServer(IApplicationBuilder, Boolean)

針對目前目錄中的目前要求路徑,啟用 上的所有靜態檔案中間件。

UseFileServer(IApplicationBuilder, FileServerOptions)

使用指定的選項啟用所有靜態檔案中間件

UseFileServer(IApplicationBuilder, String)

針對相同名稱目錄的指定要求路徑啟用所有靜態檔案中間件(目錄流覽除外)

UseFileServer(IApplicationBuilder)

針對目前目錄中的目前要求路徑啟用所有靜態檔案中間件(目錄流覽除外)。

UseForwardedHeaders(IApplicationBuilder, ForwardedHeadersOptions)

將轉送標頭套用至目前要求上的相符欄位。

依照慣例,HTTP Proxy 會從已知 HTTP 標頭中的用戶端轉送資訊。 它 ForwardedHeadersMiddleware 會讀取這些標頭,並在 HttpContext 上填入相關欄位。

UseForwardedHeaders(IApplicationBuilder)

將轉送標頭套用至目前要求上的相符欄位。

依照慣例,HTTP Proxy 會從已知 HTTP 標頭中的用戶端轉送資訊。 它 ForwardedHeadersMiddleware 會讀取這些標頭,並在 HttpContext 上填入相關欄位。

UseGoogleAuthentication(IApplicationBuilder, GoogleOptions)
已淘汰.

UseGoogleAuthentication 已過時。 使用 AddAuthentication() 設定 Google 驗證。在 ConfigureServices 中新增Google。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseGoogleAuthentication(IApplicationBuilder, GoogleOptions)

將中介軟體加入 GoogleMiddleware 指定的 IApplicationBuilder,啟用 Google 認證功能。

UseGoogleAuthentication(IApplicationBuilder)
已淘汰.

UseGoogleAuthentication 已過時。 使用 AddAuthentication() 設定 Google 驗證。在 ConfigureServices 中新增Google。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseHeaderPropagation(IApplicationBuilder)

新增一個中介軟體收集標頭,然後傳播到 HttpClient.

UseHealthChecks(IApplicationBuilder, PathString, HealthCheckOptions)

新增提供健康狀態檢查狀態的中間件。

UseHealthChecks(IApplicationBuilder, PathString, Int32, HealthCheckOptions)

新增提供健康狀態檢查狀態的中間件。

UseHealthChecks(IApplicationBuilder, PathString, Int32)

新增提供健康狀態檢查狀態的中間件。

UseHealthChecks(IApplicationBuilder, PathString, String, HealthCheckOptions)

新增提供健康狀態檢查狀態的中間件。

UseHealthChecks(IApplicationBuilder, PathString, String)

新增提供健康狀態檢查狀態的中間件。

UseHealthChecks(IApplicationBuilder, PathString)

新增提供健康狀態檢查狀態的中間件。

UseHostFiltering(IApplicationBuilder)

新增中間件,以依允許的主機標頭篩選要求。 無效的要求將會因為 400 狀態代碼而遭到拒絕。

UseHsts(IApplicationBuilder)

新增中介軟體以使用 HSTS,並加入 Strict-Transport-Security 標頭。

UseHttpLogging(IApplicationBuilder)

新增可記錄 HTTP 要求和回應的中間件。

UseHttpLoggingMiddleware(IApplicationBuilder)

將收到的 HTTP 請求登錄中介軟體登錄至 IApplicationBuilder

UseHttpMethodOverride(IApplicationBuilder, HttpMethodOverrideOptions)

允許傳入 POST 要求覆寫表單中所指定類型的方法類型。 當用戶端僅限於傳送 GET 或 POST 方法,但想要叫用其他 HTTP 方法時,會使用此中間件。

UseHttpMethodOverride(IApplicationBuilder)

允許傳入 POST 要求覆寫標頭中所指定類型的方法類型。 當用戶端僅限於傳送 GET 或 POST 方法,但想要叫用其他 HTTP 方法時,會使用此中間件。 預設情況下,X-HTTP-Method-Override 請求標頭用來指定正在隧道的 HTTP 方法。

UseHttpsRedirection(IApplicationBuilder)

將 HTTP 要求重新導向至 HTTPS 的中間件。

UseIdentity(IApplicationBuilder)
已淘汰.

這個方法已過時,未來版本將會移除。 推薦的替代方案是 UseAuthentication(IApplicationBuilder)

啟用目前應用程式的 ASP.NET 身分識別。

UseJwtBearerAuthentication(IApplicationBuilder, JwtBearerOptions)
已淘汰.
已淘汰.

UseJwtBearerAuthentication 已過時。 使用 AddAuthentication() 設定 JwtBearer 驗證。ConfigureServices 中的 AddJwtBearer。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseJwtBearerAuthentication(IApplicationBuilder, JwtBearerOptions)

將中介軟體加入 JwtBearerMiddleware 指定的 IApplicationBuilder,使持有人代幣處理能力得以實現。 此中間件會瞭解在要求標頭中顯示的適當格式和保護令牌。 如果Options.AuthenticationMode為Active,則持有人令牌內的宣告會新增至目前要求的 IPrincipal User。 如果Options.AuthenticationMode 為被動,則不會修改目前的要求,但可以隨時使用IAuthenticationManager AuthenticateAsync 從要求的持有人令牌取得宣告。 另請參閱 http://tools.ietf.org/html/rfc6749

UseJwtBearerAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseJwtBearerAuthentication 已過時。 使用 AddAuthentication() 設定 JwtBearer 驗證。ConfigureServices 中的 AddJwtBearer。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseMicrosoftAccountAuthentication(IApplicationBuilder, MicrosoftAccountOptions)
已淘汰.
已淘汰.

UseMicrosoftAccountAuthentication 已過時。 使用 AddAuthentication() 設定 MicrosoftAccount 驗證。ConfigureServices 中的 AddMicrosoftAccount。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseMicrosoftAccountAuthentication(IApplicationBuilder, MicrosoftAccountOptions)

MicrosoftAccountMiddleware 中介軟體加入指定的 IApplicationBuilder,啟用 Microsoft 帳號認證功能。

UseMicrosoftAccountAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseMicrosoftAccountAuthentication 已過時。 使用 AddAuthentication() 設定 MicrosoftAccount 驗證。ConfigureServices 中的 AddMicrosoftAccount。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseMiddleware(IApplicationBuilder, Type, Object[])

將中間件類型新增至應用程式的要求管線。

UseMiddleware<TMiddleware>(IApplicationBuilder, Object[])

將中間件類型新增至應用程式的要求管線。

UseMigrationsEndPoint(IApplicationBuilder, MigrationsEndPointOptions)

處理執行移轉作業的要求。 中介軟體會監聽對已設定路徑 options的請求。

UseMigrationsEndPoint(IApplicationBuilder)

處理執行移轉作業的要求。 中介軟體會監聽收到的 DefaultPath請求。

UseMvc(IApplicationBuilder, Action<IRouteBuilder>)

將 MVC 加入 IApplicationBuilder 請求執行管線。

UseMvc(IApplicationBuilder)

將 MVC 加入 IApplicationBuilder 請求執行管線。

UseMvcWithDefaultRoute(IApplicationBuilder)

將 MVC 加入 IApplicationBuilder 請求執行管線,預設路由名為 'default',並使用以下範本:'{controller=Home}/{action=Index}/{id?}'。

UseOAuthAuthentication(IApplicationBuilder, OAuthOptions)
已淘汰.
已淘汰.

UseOAuthAuthentication 已過時。 使用 AddAuthentication() 設定 OAuth 驗證。ConfigureServices 中的 AddOAuth。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseOAuthAuthentication(IApplicationBuilder, OAuthOptions)

將中介軟體加入 OAuthMiddleware<TOptions> 指定的 IApplicationBuilder,啟用 OAuth 2.0 認證功能。

UseOAuthAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseOAuthAuthentication 已過時。 使用 AddAuthentication() 設定 OAuth 驗證。ConfigureServices 中的 AddOAuth。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseOpenIdConnectAuthentication(IApplicationBuilder, OpenIdConnectOptions)
已淘汰.
已淘汰.

UseOpenIdConnectAuthentication 已過時。 使用 AddAuthentication() 設定 OpenIdConnect 驗證。ConfigureServices 中的 AddOpenIdConnect。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseOpenIdConnectAuthentication(IApplicationBuilder, OpenIdConnectOptions)

將中介軟體加入 OpenIdConnectMiddleware 指定的 IApplicationBuilder,啟用 OpenID Connect 認證功能。

UseOpenIdConnectAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseOpenIdConnectAuthentication 已過時。 使用 AddAuthentication() 設定 OpenIdConnect 驗證。ConfigureServices 中的 AddOpenIdConnect。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseOutputCache(IApplicationBuilder)

新增 Microsoft.AspNetCore.OutputCaching.OutputCacheMiddleware 用於快取 HTTP 回應。

UseOwin(IApplicationBuilder, Action<Action<Func<Func<IDictionary<String,Object>,Task>,Func<IDictionary<String,Object>,Task>>>>)

在指定的 IApplicationBuilder. 中介軟體中新增 OWIN 中介軟體管線。

UseOwin(IApplicationBuilder)

在指定的 IApplicationBuilder. 中加入 OWIN 管線。

UsePathBase(IApplicationBuilder, PathString)

新增中間件,從要求路徑擷取指定的路徑基底,並將它貼到要求路徑基底。

UseRateLimiter(IApplicationBuilder, RateLimiterOptions)

啟用應用程式的速率限制。

UseRateLimiter(IApplicationBuilder)

啟用應用程式的速率限制。

UseRequestCheckpoint(IApplicationBuilder)

註冊中介軟體以進行請求檢查點。

UseRequestCheckpoint(IApplicationBuilder)

向管線註冊要求檢查點相關中間件。

UseRequestDecompression(IApplicationBuilder)

新增用於動態解壓縮 HTTP 要求主體的中間件。

UseRequestLatencyTelemetry(IApplicationBuilder)

新增請求延遲遙測中介軟體以支援 IApplicationBuilder 請求執行管線。

UseRequestLatencyTelemetry(IApplicationBuilder)

新增請求延遲遙測中介軟體以支援 IApplicationBuilder 請求執行管線。

UseRequestLocalization(IApplicationBuilder, Action<RequestLocalizationOptions>)

新增 功能 RequestLocalizationMiddleware ,能根據客戶端提供的資訊自動設定請求的文化資訊。

UseRequestLocalization(IApplicationBuilder, RequestLocalizationOptions)

新增 功能 RequestLocalizationMiddleware ,能根據客戶端提供的資訊自動設定請求的文化資訊。

UseRequestLocalization(IApplicationBuilder, String[])

新增 功能 RequestLocalizationMiddleware ,能根據客戶端提供的資訊自動設定請求的文化資訊。

UseRequestLocalization(IApplicationBuilder)

新增 功能 RequestLocalizationMiddleware ,能根據客戶端提供的資訊自動設定請求的文化資訊。

UseRequestTimeouts(IApplicationBuilder)

啟用應用程式的要求逾時。

預設不會設定逾時。 它們必須在 RequestTimeoutOptionsRequestTimeoutAttribute 點上配置,或使用 WithRequestTimeout 路由擴充功能。

UseResponseBuffering(IApplicationBuilder)

啟用回應主體的完整緩衝處理。 您可以使用 IHttpBufferingFeature,根據每個要求停用此功能。

UseResponseCaching(IApplicationBuilder)

新增了 來 ResponseCachingMiddleware 快取 HTTP 回應的功能。

UseResponseCompression(IApplicationBuilder)

新增中間件以動態壓縮 HTTP 回應。

UseRewriter(IApplicationBuilder, RewriteOptions)

檢查指定的 URL 是否符合規則和條件,並在相符專案上修改 HttpContext。

UseRewriter(IApplicationBuilder)

檢查指定的 URL 是否符合規則和條件,並在相符專案上修改 HttpContext。

UseRouter(IApplicationBuilder, Action<IRouteBuilder>)

在指定IApplicationBuilder中加入RouterMiddleware一個中介軟體,並設定IRouterIRouteBuilder了 build from。

UseRouter(IApplicationBuilder, IRouter)

在指定的 IApplicationBuilderIRouter中介軟體中加入 RouterMiddleware

UseRouting(IApplicationBuilder)

在指定的 IApplicationBuilder 中新增一個 Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中介軟體。

UseSession(IApplicationBuilder, SessionOptions)

新增 以 SessionMiddleware 自動啟用應用程式的會話狀態。

UseSession(IApplicationBuilder)

新增 以 SessionMiddleware 自動啟用應用程式的會話狀態。

UseSignalR(IApplicationBuilder, Action<HubRouteBuilder>)
已淘汰.

將 SignalR 加入 IApplicationBuilder 請求執行管線。

這個方法已過時,未來版本將會移除。 建議的替代方案是在 Microsoft 裡使用 MapHub<THub>。AspNetCore.Builder.UseEndpoints(...)。

UseSpa(IApplicationBuilder, Action<ISpaBuilder>)

傳回單一頁面應用程式的默認頁面,以處理中間件鏈結中這個點的所有要求。

此中間件應該放在鏈結中後期,讓其他中間件提供靜態檔案、MVC 動作等的優先順序較高。

UseSpaStaticFiles(IApplicationBuilder, StaticFileOptions)

設定應用程式為單頁應用程式 (SPA) 提供靜態檔案。 檔案將透過註冊 ISpaStaticFileProvider 服務被定位。

UseSpaStaticFiles(IApplicationBuilder)

設定應用程式為單頁應用程式 (SPA) 提供靜態檔案。 檔案將透過註冊 ISpaStaticFileProvider 服務被定位。

UseStaticFiles(IApplicationBuilder, StaticFileOptions)

使用指定的選項啟用靜態檔案服務

UseStaticFiles(IApplicationBuilder, String)

啟用指定要求路徑的靜態檔案服務

UseStaticFiles(IApplicationBuilder)

啟用目前要求路徑的靜態檔案服務

UseStatusCodePages(IApplicationBuilder, Action<IApplicationBuilder>)

使用指定的替代中間件管線,將 StatusCodePages 中間件新增至管線,以產生響應主體。

UseStatusCodePages(IApplicationBuilder, Func<StatusCodeContext,Task>)

新增具有指定處理程式的 StatusCodePages 中間件,以檢查 400 到 599 之間沒有本文之狀態代碼的回應。

UseStatusCodePages(IApplicationBuilder, StatusCodePagesOptions)

新增具有指定選項的 StatusCodePages 中間件,以檢查具有 400 到 599 之間沒有本文之狀態代碼的回應。 若 HandleAsync 使用預設值,則嘗試產生 ProblemDetails 回應 IProblemDetailsService ,並回退至包含狀態碼的純文字回應。

UseStatusCodePages(IApplicationBuilder, String, String)

新增具有要傳送之指定響應主體的 StatusCodePages 中間件。 這可能包含狀態碼的「{0}''佔位符。 中間件會檢查狀態代碼介於 400 到 599 之間沒有本文的回應。

UseStatusCodePages(IApplicationBuilder)

用預設的回應處理器加入 a StatusCodePagesMiddleware 。 中介軟體會檢查狀態碼介於 400 到 599 之間且沒有實體的回應,當有 時 IProblemDetailsService ,嘗試產生 ProblemDetails 回應。 若服務無法使用或無法撰寫回應,則會產生包含狀態碼的純文字回應。

UseStatusCodePagesWithRedirects(IApplicationBuilder, String)

將 StatusCodePages 中間件新增至管線。 指定應該使用指定的位置 URL 範本重新導向來處理回應。 這可能包含狀態碼的「{0}''佔位符。 開頭為 『~』 的 URL 前面會加上 PathBase,其中任何其他 URL 都會像往常一樣使用。

UseStatusCodePagesWithReExecute(IApplicationBuilder, String, String, Boolean)

將 StatusCodePages 中間件新增至管線。 指定應該使用替代路徑重新執行要求管線來產生響應主體。 此路徑可能包含狀態碼的「{0}''佔位符。

UseStatusCodePagesWithReExecute(IApplicationBuilder, String, String)

將 StatusCodePages 中間件新增至管線。 指定應該使用替代路徑重新執行要求管線來產生響應主體。 此路徑可能包含狀態碼的「{0}''佔位符。

UseTwitterAuthentication(IApplicationBuilder, TwitterOptions)
已淘汰.
已淘汰.

UseTwitterAuthentication 已過時。 使用 AddAuthentication() 設定 Twitter 驗證。在 ConfigureServices 中新增Twitter。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseTwitterAuthentication(IApplicationBuilder, TwitterOptions)

TwitterMiddleware 中介軟體加入指定的 IApplicationBuilder,啟用 Twitter 驗證功能。

UseTwitterAuthentication(IApplicationBuilder)
已淘汰.
已淘汰.

UseTwitterAuthentication 已過時。 使用 AddAuthentication() 設定 Twitter 驗證。在 ConfigureServices 中新增Twitter。 如需詳細資訊,請參閱 https://go.microsoft.com/fwlink/?linkid=845470

UseW3CLogging(IApplicationBuilder)

新增中間件,以 W3C 格式記錄伺服器記錄的 HTTP 要求和回應。

UseWebAssemblyDebugging(IApplicationBuilder)

在 Chromium 開發工具中新增偵錯 Blazor WebAssembly 應用程式所需的中間件。

UseWebpackDevMiddleware(IApplicationBuilder, WebpackDevMiddlewareOptions)
已淘汰.

啟用 Webpack 開發中間件支援。 這會在你的應用程式記憶體中承載 Webpack 編譯器的實例,讓你隨時都能提供 up-to-日期 Webpack 建置的資源,而不必手動執行編譯器。 由於 Webpack 編譯程式實例會保留在記憶體中,累加編譯的速度會大幅加快從頭重新執行編譯程式的速度。

不論磁碟上的檔案為何,都會直接傳回 Webpack 編譯程式輸出來處理符合 Webpack 建置檔案的連入要求。 如果要求送達時進行編譯,回應會暫停,直到更新的編譯程序輸出就緒為止。

UseWebSockets(IApplicationBuilder, WebSocketOptions)

將 加入 WebSocketMiddleware 請求管線。

UseWebSockets(IApplicationBuilder)

將 加入 WebSocketMiddleware 請求管線。

UseWelcomePage(IApplicationBuilder, PathString)

將 WelcomePageMiddleware 新增至具有指定路徑的管線。

UseWelcomePage(IApplicationBuilder, String)

將 WelcomePageMiddleware 新增至具有指定路徑的管線。

UseWelcomePage(IApplicationBuilder, WelcomePageOptions)

將 WelcomePageMiddleware 新增至具有指定選項的管線。

UseWelcomePage(IApplicationBuilder)

將 WelcomePageMiddleware 新增至管線。

UseWhen(IApplicationBuilder, Func<HttpContext,Boolean>, Action<IApplicationBuilder>)

有條件地在要求管線中建立分支,該分支會重新加入主要管線。

適用於