2
votes

I am using Visual Studio Community 2015 Update 3. I am busy attempting to enable CORS as per this resource: https://docs.asp.net/en/latest/security/cors.html

  • I created a new .NET Core Web API project version 1.0.0.
  • In Startup.cs, under ConfigureServices() I added: services.AddCors()
  • However, after adding the following dependency to project.json: "Microsoft.AspNet.Cors": "6.0.0-rc1-final", I got the following error: 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)'

I can confirm that removing that dependency resolves the error. Any guidance would be greatly appreciated.

1

1 Answers

2
votes

So apparently I neglected to notice the conspicuous warning at the top of the page. The docs weren't yet updated for version 1.0.0.

Using "Microsoft.AspNetCore.Cors": "1.0.0" resolved this problem.