Docker containers and service discovery #5862
-
We may be missing the intent of the relationship between Aspire and containers but here goes. This scenario was us trying weave in our function app using a container as Aspire does not support function apps. In AppHost, I have this setup and the container starts up just fine. var containerService = builder.AddDockerfile(
"SomeServiceInaContainer",
"../ContextWhereDockerFileLives")
.WithEndpoint(scheme: "http", targetPort: 80, port: 8080); However, the following does not work... builder.AddProject<ABlazorClient>("client")
.WithReference(containerService)
.WithExternalHttpEndpoints(); ... and produces Argument 2: cannot convert from 'Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ContainerResource>' to 'Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.IResourceWithConnectionString>' Are we approaching this scenario correctly? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You need to explicitly reference an endpoint. When you are using a base container, there's no service discovery assumed (it could be a connection string you wanted injected vs service discovery information). builder.AddProject<ABlazorClient>("client")
.WithReference(containerService.GetEndpoint("http"))
.WithExternalHttpEndpoints(); See this WithReference overload |
Beta Was this translation helpful? Give feedback.
You need to explicitly reference an endpoint. When you are using a base container, there's no service discovery assumed (it could be a connection string you wanted injected vs service discovery information).
See this WithReference overload