diff --git a/Swagger.Net.WebAPI/App_Start/SwaggerNet.cs b/Swagger.Net.WebAPI/App_Start/SwaggerNet.cs index 82043f3..75d988a 100644 --- a/Swagger.Net.WebAPI/App_Start/SwaggerNet.cs +++ b/Swagger.Net.WebAPI/App_Start/SwaggerNet.cs @@ -14,18 +14,17 @@ public static class SwaggerNet { public static void PreStart() { - RouteTable.Routes.MapHttpRoute( - name: "SwaggerResourceList", - routeTemplate: "apidocs/swagger", - defaults: new { swagger = true, controller = "Swagger", action = "GetResourceList" } - ); - RouteTable.Routes.MapHttpRoute( - name: "SwaggerApiDeclaration", - routeTemplate: "apidocs/{controllerName}", - defaults: new { swagger = true, controller = "Swagger", action = "GetApiDeclaration" } - ); + //RouteTable.Routes.MapHttpRoute( + // name: "SwaggerResourceList", + // routeTemplate: "api/swagger", + // defaults: new { swagger = true, controller = "Swagger", action = "GetResourceList" } + //); + //RouteTable.Routes.MapHttpRoute( + // name: "SwaggerApiDeclaration", + // routeTemplate: "apidocs/{controllerName}", + // defaults: new { swagger = true, controller = "Swagger", action = "GetApiDeclaration" } + //); - SwaggerConfiguration.DefaultConfiguration = SwaggerConfiguration.CreateDefaultConfig(GlobalConfiguration.Configuration); } } } \ No newline at end of file diff --git a/Swagger.Net.WebAPI/Controllers/BlogPostsController.cs b/Swagger.Net.WebAPI/Controllers/BlogPostsController.cs index 9aa22ae..a08ced0 100644 --- a/Swagger.Net.WebAPI/Controllers/BlogPostsController.cs +++ b/Swagger.Net.WebAPI/Controllers/BlogPostsController.cs @@ -7,6 +7,12 @@ namespace Swagger.Net.WebApi.Controllers { + /// + /// This is blog posts controller summary + /// + /// + /// This is blog posts controller remarks + /// public class BlogPostsController : ApiController { // GET api/blogposts diff --git a/Swagger.Net.WebAPI/Global.asax.cs b/Swagger.Net.WebAPI/Global.asax.cs index 9f40d87..0dc5d0d 100644 --- a/Swagger.Net.WebAPI/Global.asax.cs +++ b/Swagger.Net.WebAPI/Global.asax.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Web; using System.Web.Http; +using System.Web.Http.Description; using System.Web.Mvc; using System.Web.Optimization; using System.Web.Routing; @@ -22,6 +24,11 @@ protected void Application_Start() FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); + + var baseType = HttpContext.Current.ApplicationInstance.GetType().BaseType; + var assemblyname = Assembly.GetAssembly(baseType).GetName().Name; + var path = HttpContext.Current.Server.MapPath("~/bin/" + assemblyname + ".xml"); + GlobalConfiguration.Configuration.Services.Replace(typeof(IDocumentationProvider),new XmlCommentDocumentationProvider(path)); } } } \ No newline at end of file diff --git a/Swagger.Net.WebAPI/Views/Home/Index.cshtml b/Swagger.Net.WebAPI/Views/Home/Index.cshtml index 38ebf05..0af07e6 100644 --- a/Swagger.Net.WebAPI/Views/Home/Index.cshtml +++ b/Swagger.Net.WebAPI/Views/Home/Index.cshtml @@ -1,4 +1,4 @@ 

Welcome to ASP.NET Web API!

Navigate to /docs for the Swagger UI docs. These are not included in the NuGet package.
-Navigate to /api/swagger to see the JSON specification emitted.
+Navigate to /api/swagger to see the JSON specification emitted.
You may then navigate to each api path to see the JSON documentation for each ApiController individually. \ No newline at end of file diff --git a/Swagger.Net.WebAPI/Web.config b/Swagger.Net.WebAPI/Web.config index c42c5ff..1b529f2 100644 --- a/Swagger.Net.WebAPI/Web.config +++ b/Swagger.Net.WebAPI/Web.config @@ -12,6 +12,7 @@ + diff --git a/Swagger.Net.WebAPI/docs/index.html b/Swagger.Net.WebAPI/docs/index.html index 361a9c5..d7bf7c7 100644 --- a/Swagger.Net.WebAPI/docs/index.html +++ b/Swagger.Net.WebAPI/docs/index.html @@ -42,7 +42,7 @@