orleans: Asp.Net core 7 + orleans + swagger does not work
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<LoggingInterceptor>()
.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?
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 17 (8 by maintainers)
So are there any problems in future if we’re not going to scale to multiple hosts (machines running our application)?
And I fixed the issue)
HostAllocatorBackgroundService
was inheriting from IHostedService, not from BackgroundService, so it is not something related to orleans…What does Orleans log? Does the silo start?
By the way, Orleans shares the DI container with the host, so when you configure logging within UseOrleans, you’re also configuring it for the rest of the host.