共用方式為


RoutingEndpointConventionBuilderExtensions.RequireHost<TBuilder> 方法

定義

要求端點在路由期間符合其中一個指定的主機。

public:
generic <typename TBuilder>
 where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
 static TBuilder RequireHost(TBuilder builder, ... cli::array <System::String ^> ^ hosts);
public static TBuilder RequireHost<TBuilder> (this TBuilder builder, params string[] hosts) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireHost : 'Builder * string[] -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireHost(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, ParamArray hosts As String()) As TBuilder

類型參數

TBuilder

參數

builder
TBuilder

IEndpointConventionBuilder 加入中繼資料的 。

hosts
String[]

路由期間使用的主機。 主機應該是 Unicode 而不是 punycode,而且可能有埠。 空集合表示將接受任何主機。

傳回

TBuilder

完成作業之後,這個執行個體的參考。

適用於