Я только что создал новое приложение asp net core 2.0 и добавил swagger с nuget.
Когда я пытаюсь запустить приложение, я получаю следующую ошибку после включения журналов стандартного вывода:
Application startup exception: System.MissingMethodException: Method not found: 'Void Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions.IncludeXmlComments(System.String)'.
at Ituran.Framework.Startup.StartupExtensions.<>c__DisplayClass10_0.<ConfigureServicesExtensions>b__7(SwaggerGenOptions c)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at Microsoft.Extensions.DependencyInjection.SwaggerGenServiceCollectionExtensions.CreateSwaggerProvider(IServiceProvider serviceProvider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
Application startup exception
System.MissingMethodException: Method not found: 'Void Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions.IncludeXmlComments(System.String)'.
at Ituran.Framework.Startup.StartupExtensions.<>c__DisplayClass10_0.<ConfigureServicesExtensions>b__7(SwaggerGenOptions c)
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at Microsoft.Extensions.DependencyInjection.SwaggerGenServiceCollectionExtensions.CreateSwaggerProvider(IServiceProvider serviceProvider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Hosting environment: Localhost
Content root path: {PATH_OF_PROJECT}
Now listening on: http://localhost:23419
Application started. Press Ctrl+C to shut down.
Вот мой Startup.cs
public class Startup
{
private StartupExtensions StartupExtensions { get; set; }
private IConfigurationRoot Configuration { get; set; }
public Startup(IHostingEnvironment env)
{
StartupExtensions = new StartupExtensions($"{env.EnvironmentName}");
Configuration = StartupExtensions.Init();
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
StartupExtensions.ConfigureServicesExtensions(services, Configuration, new SwaggerConfiguration
{
Title = "EmergencyEvent Api",
Version = "v1",
Description = "API de integração HDI"
}, false);
// Dependency Injection
services.AddScoped<IAuthenticationProvider, IturanAuthenticationProvider>();
services.AddScoped<IIturanAuthenticationService, IturanAuthenticationService>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
StartupExtensions.ConfigureExtensions(loggerFactory, app, Configuration, new SwaggerConfigurationUrl
{
ApiDevelopmentName = "api.emergencyevent",
ApiStagingName = "api.emergencyevent",
ApiProductionName = "api.emergencyevent"
});
}
}
Я имеюпопытался удалить конфигурацию swagger из моего startup.cs, но приложение все еще не запущено.