简体   繁体   中英

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

在此处输入图像描述

My Controller

在此处输入图像描述

Swagger-UI

在此处输入图像描述

what have I have missed?

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();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM