Search code examples
c#webswaggerswashbuckle.net-4.6

C# Swashbuckle.Net45 didn't show controllers on Swagger UI


I have add Swashbuckle.Net45 (Swagger) to my C# (.NET 4.6) 2 different web projects. on one everything working great on another I don't see any controller on Swagger-UI.

as I know the configuration must be very easy.

"Swashbuckle.Net45" config file

enter image description here

My Controller

enter image description here

Swagger-UI

enter image description here

what have I have missed?


Solution

  • A common Error is when you create your Controller File as a class instead of Mvc-/API-Controller file. Even though the code is the same, it won't work.

    And make sure you add the Controllers in the startup.cs/program.cs. Example:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllers();
        //or
        services.AddMvc();
    }