tout en essayant de jeton Ajouter au porteur en utilisant Swashbuckle fanfaronnades-documentsEnableApiKeySupport génère l'erreur
j'ai eu cette erreur dans SwaggerConfig.cs swaggeruiconfig ne contient pas la définition pour 'EnableApiKeySupport'
faire n'importe quel corps savoir ce que peut être la raison
Mettre à jour
c'est toute swagger.config
using System.Web.Http;
using WebActivatorEx;
using Swashbuckle.Application;
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
namespace AppNameSpace
{
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.ApiKey("Token")
.Description("Filling bearer token here")
.Name("Authorization")
.In("header");
c.SingleApiVersion("v2", "AppNameSpace");
c.IncludeXmlComments(GetXmlCommentsPath());
})
.EnableSwaggerUi(c =>
{
c.EnableApiKeySupport("Authorization", "header");
});
}
protected static string GetXmlCommentsPath()
{
return System.String.Format(@"{0}\bin\AppNameSpace.XML", System.AppDomain.CurrentDomain.BaseDirectory);
}
}
}
Cela devrait fonctionner très bien! Pouvez-vous coller l'ensemble de votre SwaggerConfig.cs dans la question ... – HelderSepu
Aussi quelle version de swashbuckle utilisez-vous? – HelderSepu
Swashbuckle version 5.6.0 –