我正在使用Visual Studio Community 2015 Update 3。 我正忙着尝试根据此资源启用CORS: https://docs.asp.net/en/latest/security/cors.html
ConfigureServices()
下我添加了:
services.AddCors()
project.json
添加以下依赖项之后:
"Microsoft.AspNet.Cors": "6.0.0-rc1-final"
,我收到以下错误:
The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.CorsServiceCollectionExtensions.AddCors(Microsoft.Extensions.DependencyInjection.IServiceCollection)' and 'Microsoft.Extensions.DependencyInjection.CorsServiceCollectionExtensions.AddCors(Microsoft.Extensions.DependencyInjection.IServiceCollection)'
我可以确认删除该依赖项可以解决错误。任何指导将不胜感激。
答案 0 :(得分:2)
使用"Microsoft.AspNetCore.Cors": "1.0.0"
解决了这个问题。