dotnet / dotnet/orleans

Asp.Net core 7 + orleans + swagger does not work

Open
#8,241 17 comments 0 reactions 0 assignees View on GitHub
Needs: triage :mag:
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
13h 56m
Merged PRs (30d)
351

Description

I have the following problem,
I have registered my web app as following

```
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddLogging();
Di.Configure(builder.Services, builder.Configuration);
builder.Host.UseOrleans(silo =>
{
silo
.UseLocalhostClustering()
//.AddMemoryGrainStorage(GrainsStorageConstants.StorageName)
//.AddMemoryGrainStorageAsDefault()
.ConfigureLogging(logging => logging.AddJsonConsole().SetMinimumLevel(LogLevel.Information))
.AddIncomingGrainCallFilter()
.AddAdoNetGrainStorage(GrainsStorageConstants.StorageName, options =>
{
options.Invariant = "Npgsql";
options.ConnectionString = builder.Configuration.GetConnectionString("postgres");
});

});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
```

As you see I use UseSwagger and UseSwaggerUI, so swagger page should be shown on the startup.
However chrome says me **This site can’t be reached** when I try to reach swagger UI.

When I remove `builder.Host.UseOrleans(` with all the orleans stuff swagger shows up again

Any ideas why this could happen?

Contributor guide

Open the contributing guide

Research direction

Start with the provided ASP.NET Core startup code and reproduce the failure with UseOrleans enabled, then compare it with the configuration where the Orleans setup is removed. Inspect the Orleans hosting and Swagger pipeline interaction; done means the Swagger UI is reachable while the shown Orleans and PostgreSQL configuration remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi, postgresql
Domain
api, backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.