CorsServiceCollectionExtensions.AddCors 方法

定义

重载

AddCors(IServiceCollection)

将跨源资源共享服务添加到指定的 IServiceCollection

AddCors(IServiceCollection, Action<CorsOptions>)

将跨源资源共享服务添加到指定的 IServiceCollection

AddCors(IServiceCollection)

Source:
CorsServiceCollectionExtensions.cs
Source:
CorsServiceCollectionExtensions.cs
Source:
CorsServiceCollectionExtensions.cs

将跨源资源共享服务添加到指定的 IServiceCollection

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddCors (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddCors : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddCors (services As IServiceCollection) As IServiceCollection

参数

services
IServiceCollection

要向其中添加服务的 IServiceCollection

返回

IServiceCollection,以便可以链接其他调用。

适用于

AddCors(IServiceCollection, Action<CorsOptions>)

Source:
CorsServiceCollectionExtensions.cs
Source:
CorsServiceCollectionExtensions.cs
Source:
CorsServiceCollectionExtensions.cs

将跨源资源共享服务添加到指定的 IServiceCollection

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddCors (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsOptions> setupAction);
static member AddCors : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddCors (services As IServiceCollection, setupAction As Action(Of CorsOptions)) As IServiceCollection

参数

services
IServiceCollection

要向其中添加服务的 IServiceCollection

setupAction
Action<CorsOptions>

用于配置所提供的 CorsOptionsAction<T>

返回

IServiceCollection,以便可以链接其他调用。

适用于