Last active
May 20, 2025 15:29
-
-
Save slovely/37cee8c8e758cfba0c58796be6d5aea9 to your computer and use it in GitHub Desktop.
Aspire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in the app host: | |
| // Has a database that I can reference with EF no issue | |
| var db = builder.AddPostgres("db").AddDatabase("db"); | |
| // Custom dockerfile which has an app running on container port 8080 | |
| var svc = builder.AddDockerfile( "svc", "./", "./Dockerfile") | |
| .WithEndpoint(0, 8080, "http", "http") | |
| ; | |
| var backend = builder.AddProject<MyProject>("backend") | |
| .WithReference(db) | |
| .WithReference(svc.GetEndpoint("http")) | |
| .WaitFor(db) | |
| ; | |
| // Then inside the "MyProject" startup I have this: | |
| builder.Services.AddHttpClient<ITheService, TheService>(static client => client.BaseAddress = new Uri("http://svc")); | |
| // but when I use that, I get | |
| // HttpRequestException: Name or service not known (svc:80) | |
davidfowl
commented
May 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment