C
C#4w ago
Angius

Aspire project won't run if `applicationUrl` given in `launchSettings.json`

Weirdest shit ever...
"profiles": {
"Ogma3": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001"
}
}
"profiles": {
"Ogma3": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001"
}
}
and going to https://localhost:5001 results in endless loading until the request times out, but
"profiles": {
"Ogma3": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
"profiles": {
"Ogma3": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
makes the link not show on Aspire dashboard, true, but manually going to https://localhost:5001 works just peachy... My Aspire config if it matters:
var builder = DistributedApplication.CreateBuilder(args);

var sqlPassword = builder.AddParameter("postgres-password", secret: true);
var sqlUsername = builder.AddParameter("postgres-username", secret: true);

var database = builder
.AddPostgres("postgres", sqlUsername, sqlPassword)
.WithDataVolume()
.WithLifetime(ContainerLifetime.Persistent)
.WithPgWeb()
.AddDatabase("ogma3-db");

builder
.AddProject<Projects.Ogma3>("ogma3")
.WithReference(database)
.WaitFor(database);

builder.Build().Run();
var builder = DistributedApplication.CreateBuilder(args);

var sqlPassword = builder.AddParameter("postgres-password", secret: true);
var sqlUsername = builder.AddParameter("postgres-username", secret: true);

var database = builder
.AddPostgres("postgres", sqlUsername, sqlPassword)
.WithDataVolume()
.WithLifetime(ContainerLifetime.Persistent)
.WithPgWeb()
.AddDatabase("ogma3-db");

builder
.AddProject<Projects.Ogma3>("ogma3")
.WithReference(database)
.WaitFor(database);

builder.Build().Run();
15 Replies
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
You mean the
builder.AddNpgsqlDbContext<YourDbContext>(connectionName: "postgresdb");
builder.AddNpgsqlDbContext<YourDbContext>(connectionName: "postgresdb");
? If so, then no. Couldn't figure out how to do enum registration for Npgsql with this method, so I'm just taking the connection string injected by Aspire into the config Huh, it works if I comment out builder.WebHost.UseUrls("https://+:5001");
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
Yeah Here's the repo if you wanted to take a glance at whether I'm doing the Aspire thing correctly: https://github.com/Genfic/Ogma I have to figure out some better way of applying migrations and seeding data, methinks
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
No apis and clients yet Just a razor pages project + pg
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
Aspire seemed more ergonomic to me than docker compose lol
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
Honestly, no idea why that line was there either, tbh :KEKW: This project's been going on for years now, I forgot what half the config does The JSON output (enums as strings, don't write null props) is configured thrice lmao
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
Razor Pages + a single MVC controller to redirect some stuff that pages couldn't do + Immediate.Apis
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Angius
AngiusOP3w ago
Let me check... https://github.com/Genfic/Ogma/blob/master/Ogma3/Controllers/Chapter.cs I guess this could be replaced by an endpoint
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?