Adding swagger

Rajarajacholan Krishnamurthy 31 Reputation points
2023-08-17T08:27:23.3266667+00:00

Even though I have added AddSwaggerGen in ConfigureService, Why I am still getting the error message:

Be sure that the Startup.cs for your application is calling AddSwaggerGen from within ConfigureServices in order to generate swagger

 public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title = "HPlusSports API",
                    Version = "1.0",
                    Description = "Product API for HPlusSports"
                });
            });
        }
Developer technologies ASP.NET ASP.NET Core
Developer technologies ASP.NET ASP.NET API
{count} votes

1 answer

Sort by: Most helpful
  1. Rajarajacholan Krishnamurthy 31 Reputation points
    2023-08-22T13:47:26.9133333+00:00

    Strangely, the deployed API works though getting publish error! Just got confused on the error message!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.