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

完成操作后对此实例的引用。

适用于