Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Failed to load API definition. Fetch error. Not Found /swagger/v1/swagger.json

Open Exagram opened this issue 3 years ago • 4 comments

Thanks for contributing to Swashbuckle.AspNetCore! As per the contributing guidelines, please adhere to the following rules of thumb before submitting your issue:

  1. If it's not a bug report, feature request or PR, don't submit it here. Post to Stackoverflow instead.
  2. If your issue is specifically a UI concern, don't submit it here. Post to the swagger-ui repo.
  3. For bug reports, specify the version you're using and provide clear repro steps.

Swashbuckle Version 6.2.3.

Steps:

  • In Visual Studio debug the project.
  • Navigate to localhost:12345/swagger
  • Observe "LOADING" for a few minutes
  • After a few minutes observe: Failed to load API definition. Fetch Error. Not Found /swagger/v1/swagger.json

startup.cs

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Version = "v1",
                    Title = "...",
                    Description = "...",
                    Contact = new OpenApiContact
                    {
                        Name = "...",
                        Email = "[email protected]",
                        Url = new Uri("https://...")
                    }
                });

                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
            });

...

                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/v1/swagger.json", "...");
                });

Exagram avatar Nov 04 '21 13:11 Exagram