我使用这篇文章创建了一个WebApi项目.
事情很好.但现在我的客户想要使用Swagger查看文档.我试着做配置,但事情没有用.没有获得控制器列表及其操作.
下面是招摇配置:
using System.Web.Http;
using WebActivatorEx;
using DC.SUMS.WebAPI1;
using Swashbuckle.Application;
using System;
using System.Linq;
using Swashbuckle.Swagger;
using Swashbuckle.Dummy.SwaggerExtensions;
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
namespace DC.SUMS.WebAPI1
{
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
// By default, the service root url is inferred from the request used to access the docs.
// However, there may be situations (e.g. proxy and load-balanced environments) where this does not
// resolve correctly. You …Run Code Online (Sandbox Code Playgroud)