CorsMiddlewareExtensions.UseCors 方法

定义

重载

UseCors(IApplicationBuilder)

将 CORS 中间件添加到你的 Web 应用程序管道,以允许跨域请求。

UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)

将 CORS 中间件添加到你的 Web 应用程序管道,以允许跨域请求。

UseCors(IApplicationBuilder, String)

将 CORS 中间件添加到你的 Web 应用程序管道,以允许跨域请求。

UseCors(IApplicationBuilder)

将 CORS 中间件添加到你的 Web 应用程序管道,以允许跨域请求。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseCors(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseCors (this Microsoft.AspNetCore.Builder.IApplicationBuilder app);
static member UseCors : Microsoft.AspNetCore.Builder.IApplicationBuilder -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseCors (app As IApplicationBuilder) As IApplicationBuilder

参数

app
IApplicationBuilder

传递给配置方法的 IApplicationBuilder

返回

IApplicationBuilder

原始应用参数

适用于

UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)

将 CORS 中间件添加到你的 Web 应用程序管道,以允许跨域请求。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseCors(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app, Action<Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicyBuilder ^> ^ configurePolicy);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseCors (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> configurePolicy);
static member UseCors : Microsoft.AspNetCore.Builder.IApplicationBuilder * Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseCors (app As IApplicationBuilder, configurePolicy As Action(Of CorsPolicyBuilder)) As IApplicationBuilder

参数

app
IApplicationBuilder

传递给配置方法的 IApplicationBuilder。

configurePolicy
Action<CorsPolicyBuilder>

可使用策略生成器生成策略的委托。

返回

IApplicationBuilder

原始应用参数

适用于

UseCors(IApplicationBuilder, String)

将 CORS 中间件添加到你的 Web 应用程序管道,以允许跨域请求。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseCors(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app, System::String ^ policyName);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseCors (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, string policyName);
static member UseCors : Microsoft.AspNetCore.Builder.IApplicationBuilder * string -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseCors (app As IApplicationBuilder, policyName As String) As IApplicationBuilder

参数

app
IApplicationBuilder

传递给配置方法的 IApplicationBuilder

policyName
String

已配置的策略的策略名称。

返回

IApplicationBuilder

原始应用参数

适用于