共用方式為


CorsServiceCollectionExtensions.AddCors 方法

定義

多載

AddCors(IServiceCollection)

將跨原始來源資源分享服務新增至指定的 IServiceCollection

AddCors(IServiceCollection, Action<CorsOptions>)

將跨原始來源資源分享服務新增至指定的 IServiceCollection

AddCors(IServiceCollection)

來源:
CorsServiceCollectionExtensions.cs
來源:
CorsServiceCollectionExtensions.cs
來源:
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>)

來源:
CorsServiceCollectionExtensions.cs
來源:
CorsServiceCollectionExtensions.cs
來源:
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,以便鏈結其他呼叫。

適用於