If you are using NET framework (any version capable of having swagger)
in you web.config,
1. create a new key called IsSwaggerEnabled and set it to true
<appSettings>
<add key="IsSwaggerEnabled" value="true" />
</appSettings>
2. If you installed swagger from nuget package already, then you have the (*\App_Start\SwaggerConfig.cs)
in there find the Register() method and add code as the following
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
bool isSwaggerEnabled = ConfigurationManager.AppSettings["IsSwaggerEnabled"] != null ?
bool.Parse(ConfigurationManager.AppSettings["IsSwaggerEnabled"]) : true;
if (!isSwaggerEnabled)
return;
GlobalConfiguration.Configuration
.EnableSwagger(c =>