Swagger-Net返回规范中未定义任何操作

时间:2019-10-29 20:43:18

标签: c# asp.net-mvc swagger

我已按照github的指示进行操作,并且JSON中没有任何路径或定义。这是我的SwaggerConfig

public static void Register()
{
    var thisAssembly = typeof(SwaggerConfig).Assembly;

    GlobalConfiguration.Configuration
        .EnableSwagger(c =>
        {
            c.SingleApiVersion("v1", "Test");
            c.ApiKey("apiKey", "header", "API Key Authentication", typeof(D2TokenFilter));
            c.AccessControlAllowOrigin("*");
            c.IncludeXmlComments(AppDomain.CurrentDomain.BaseDirectory + "bin/Test.XML");
            c.IgnoreIsSpecifiedMembers();
            c.DescribeAllEnumsAsStrings(camelCase: false);        
        })
        .EnableSwaggerUi(c =>
        {
            c.ShowExtensions(true);
            c.SetValidatorUrl("https://online.swagger.io/validator");
            c.UImaxDisplayedTags(100);
            c.UIfilter("''");
        });
}

我正在使用.net mvc 4.5.1。我的控制器不一定命名为API控制器,但它们确实包含与以下内容类似的内容:

[AllowAnonymous]
[TestTokenFilter]
[Route("[controller]/[action]")]
public class TestApiController : APIController
{
    #region GENERAL DATA
    /// <summary>
    /// Retrives Client IDs based on company ID and user ID input
    /// </summary>
    /// <returns></returns>
    [HttpGet]

    public JsonResult GetClientIDByCompany()
    {
        ...
    }
}

还是我想出

  

未在规范中定义操作

0 个答案:

没有答案