CorsEndpointConventionBuilderExtensions.RequireCors 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
RequireCors<TBuilder>(TBuilder) |
将具有默认策略名称的 CORS 策略添加到终结点 () 。 |
RequireCors<TBuilder>(TBuilder, Action<CorsPolicyBuilder>) |
将指定的 CORS 策略添加到终结点 () 。 |
RequireCors<TBuilder>(TBuilder, String) |
将具有指定名称的 CORS 策略添加到终结点 () 。 |
RequireCors<TBuilder>(TBuilder)
将具有默认策略名称的 CORS 策略添加到终结点 () 。
public static TBuilder RequireCors<TBuilder> (this TBuilder builder) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireCors : 'Builder -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireCors(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder) As TBuilder
类型参数
- TBuilder
参数
- builder
- TBuilder
终结点约定生成器。
返回
TBuilder
原始约定生成器参数。
适用于
RequireCors<TBuilder>(TBuilder, Action<CorsPolicyBuilder>)
将指定的 CORS 策略添加到终结点 () 。
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireCors(TBuilder builder, Action<Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicyBuilder ^> ^ configurePolicy);
public static TBuilder RequireCors<TBuilder> (this TBuilder builder, Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> configurePolicy) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireCors : 'Builder * Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireCors(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, configurePolicy As Action(Of CorsPolicyBuilder)) As TBuilder
类型参数
- TBuilder
参数
- builder
- TBuilder
终结点约定生成器。
- configurePolicy
- Action<CorsPolicyBuilder>
可以使用策略生成器生成策略的委托。
返回
TBuilder
原始约定生成器参数。
适用于
RequireCors<TBuilder>(TBuilder, String)
将具有指定名称的 CORS 策略添加到终结点 () 。
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireCors(TBuilder builder, System::String ^ policyName);
public static TBuilder RequireCors<TBuilder> (this TBuilder builder, string policyName) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireCors : 'Builder * string -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireCors(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, policyName As String) As TBuilder
类型参数
- TBuilder
参数
- builder
- TBuilder
终结点约定生成器。
- policyName
- String
CORS 策略名称。
返回
TBuilder
原始约定生成器参数。