I need some help, there is a .net core 3.1 project that includes swagger, swagger UI works in local but when is deployed.
ConfigureServices method
-
- services.AddSwaggerGen(c =>
- {
- c.SwaggerDoc("v1", new OpenApiInfo
- {
- Title = "my app V1",
- Version = "v1"
- });
- c.ExampleFilters();
- c.OperationFilter();
-
- var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
- var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
- c.IncludeXmlComments(xmlPath);
- });
- services.ConfigureSwaggerGen(options =>
- {
- options.CustomSchemaIds(x => x.FullName);
- });
- services.AddSwaggerExamplesFromAssemblies();
Configure Method
- app.UseSwaggerUI(c =>
- {
- c.RoutePrefix = "swagger";
- c.SwaggerEndpoint("./v1/swagger.json", "my app V1");
- c.DefaultModelsExpandDepth(-1);
- });