0

I just deployed my web api to elasticbeanstalk but it doesn't render anything, even swagger ui. This is my environment which shows that the status of it is healthy and okay:

EB Environment

Then this is the deployment status, this also shows that the deployment went through and it is successful:

deployment status

And this where I get the page not found and I want to be able to view the endpoints using swagger, I have tried adding /swagger/index.html to the url and it still gives an error

Error

This is my Program.cs: enter image description here enter image description here

3 Answers 3

0

Elastic Beanstalk might block certain routes by default. To ensure access to the Swagger UI:

Make sure that the web.config file (or similar configuration) exists in your project and is properly configured.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Ehsanfaridi, thanks for your reply, web.config doesn't seem to exist in my project.
0
  1. In many projects, Swagger is only enabled in the Development environment by default. If your Program.cs looks like this:
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

Please Change Environment or remove if statement.

2. Make sure Swagger is properly configured in your Program.cs file:

app.UseSwagger();
app.UseSwaggerUI(c =>
{
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
    c.RoutePrefix = string.Empty; // Makes Swagger UI accessible at the root (e.g., https://yourdomain.com/)
});

Comments

0

To fix this issue I had to redo the solution and not enable https

1 Comment

Did you figure out what difference redoing it made in the actual project? Figuring this out could help both you and others solve similar problems without redoing everything from scratch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.