Ask a Question

AspNetCore 3.1 swagger ui only displays Loading

gpl
New Contributor

AspNetCore 3.1 swagger ui only displays Loading

Hello,

I'm working on a project, that started with aspnet core 1.1. It was upgraded to 2.2 and latest on to 3.1. During the upgrade of 1.1 to 2.2 the swagger was working without any problems. But the upgrade from 2.2 to 3.1 has broken something and I commented out the swagger.
I'm now trying to re-enable swagger but when I point to the swagger endpoint I only see a "Loading" spinner.

Within a newly created project without only basic controller I'm able to see the swagger documentation.

 

My current state looks like this:

 

public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();
            // services.AddMvcCore().AddApiExplorer();
            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });

// Authentication and Authorization is added
services.AddCors(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "my API", Version = "v1" }); }); }
public void Configure(
            IApplicationBuilder app,
            IWebHostEnvironment env)
        {
             ....
             app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "my API");
            });
           app.UseRouting();
            app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader());
            app.UseForwardedHeaders();

            app.UseAuthentication();
            app.UseAuthorization();
            
            app.UseEndpoints(p => p.MapControllerRoute(name: "default", pattern: "{controller}/{action=Index}/{id?}"));

            app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseAngularCliServer(npmScript: "start");
                }
            });
}

Output looks like this:

 

Swagger.png

I hope someone has some ideas or could suggest something


Kind regards

2 REPLIES 2
HKosova
SmartBear Alumni (Retired)

Hi @gpl,

 

Swashbuckle is not one of our projects and we don't know it well enough to provide support for it. Please open a ticket with Swashbuckle directly:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
gpl
New Contributor

Ah sorry. Thank you for your answer.

cancel
Showing results for 
Search instead for 
Did you mean: