Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS Error #856

Closed
devingoble opened this issue Jul 25, 2017 · 2 comments
Closed

CORS Error #856

devingoble opened this issue Jul 25, 2017 · 2 comments

Comments

@devingoble
Copy link

I just created a new ASP.NET Core 2.0 web application, and installed NSwag.AspNetCore.

I added services.AddCors() as well as

app.UseSwaggerUi(typeof(Startup).GetTypeInfo().Assembly, new SwaggerUiSettings()
{
	DefaultPropertyNameHandling = NJsonSchema.PropertyNameHandling.CamelCase
});

However, Swagger UI is returning the following error:

Can't read from server. It may not have the appropriate access-control-origin settings.

I enabled CORS, but I'm still getting the same error.

@RicoSuter
Copy link
Owner

Try calling the json url directly, then you will see the actual error. Its most probably not a cors problem...

@devingoble
Copy link
Author

Ok, that was it. However, there's something weird about the current ASP.NET Core template. Swagger doesn't really like any of the OOTB controllers. I'll keep after it, but this takes care of my immediate issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants