I try to use Swagger with Microsoft WebAPI 2.
For the moment, I\'ve the following call in a method.
appBuilder
.ConfigureOAuth()
.UseWebApi(con
Ok, here is one way of doing it. Add a new MVC controller (Not Web API) e.g HomeController and in the Index action add the following code:
using System.Web.Mvc;
namespace Kids.Math.Api.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return new RedirectResult("~/swagger/ui/index");
}
}
}
Also, make sure your route config has the follow (Note, by default it already does)
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}