cancel
Showing results for 
Search instead for 
Did you mean: 

AspNetCore 3.1 swagger ui only displays Loading

Highlighted
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
Highlighted
Moderator

Re: AspNetCore 3.1 swagger ui only displays Loading

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
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
New Contributor

Re: AspNetCore 3.1 swagger ui only displays Loading

Ah sorry. Thank you for your answer.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors