Swashbuckle.aspnetcore: Failed to load API definition Failed to fetch

Created on 29 Aug 2018  路  6Comments  路  Source: domaindrivendev/Swashbuckle.AspNetCore

Asp.Net Core version:

.netcoreapp2.0

Swagger version:

Swashbuckle.AspNetCore 3.0.0

Error description:

I can access the swagger.json file directly and got 200,but when I access the swagger index,
I met the error as follows:

image
image

Most helpful comment

It was my chrome ad block plugin caused...

All 6 comments

I've checked every method in controller and there's no method without httpVerboses(HttpGet,HttpPost..) attribute

It was my chrome ad block plugin caused...

I ran into the same issue, can I know what you did to solve it?

Im in guys

I ran into the same issue, can I know what you did to solve it?

Did you solved this?

I ran into the same issue, can I know what you did to solve it?

Did you solved this?

In my case it was wrong configuration in Startup.

code in ConfigureServices was

csharp services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1" }); var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); }

and code in Configure method was

csharp app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v2/swagger.json", "v2"); });

Problem was: I made middleware with root swagger/v2 json, but defined swagger/v1 above.
Maybe you do the same?

Was this page helpful?
0 / 5 - 0 ratings