-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change how container connection strings resolve the right endpoint #844
Comments
You said "it gives me errors" , what errors? |
Well.. I simplified the application.. When I start with the .NET Aspire Starter application and update the following code in the AppHost program.cs: file
receive the following error:
Docker Desktop 4.25.1 |
When playing around with it... when I specify a host-port when adding the sql container, It all works...
I was not aware that 1433 was not the default (internal) port, but a random port was assigned. Thx a lot! |
When you configure service binding such as
Calls to I'm probably understanding this wrong :D So please do help :D Me as I guess the author of this issue wanted to expose these standard ports so I can have it uniformly the same, and not have to see what my dynamically allocated ports are from the dashboard or peeking into environment variables |
The built in overloads support a "port" parameter which maps to the host port. Adding more bindings to those will make connection string resolution fail (as currently implemented). We could make this not fail by looking for a specific endpoint binding, but it doesn't change "how" you make this work. |
cc @mitchdenny should we do something here? Most of our containers would fail like this in connection string resolution. |
There are a few choices here. The first is that we could simply change the |
This is what I think we should be doing. |
@JamesNK this is a good one for P4 |
@BrennanConroy moving to you |
Moved to P5 |
All container resources now use a named endpoint as their default and that's what the connection string is based on. |
We should change how allocation endpoints are determine the connection string by using an endpoint called "default" instead of using
SingleOfDefault
everywhere.Original Issue
Hi,
I have an Aspire application with an sql-container:
The container with the sql server is created and because of "dbserver.WithServiceBinding(1433, 1433)" I can connect with my SSMS to this database...
But once I uncomment the 3 lines (with the .WithReference to the databases), it gives me errors on the app.Run().
When I comment out 'dbserver.WithServiceBinding(1433, 1433)', the app is working, but I'm not able to connect with SSMS anymore to the database.
So my question is: what is the correct way to open the 1433 port on the sql container to be availabe on the host machine (in ssms for example).
thx a lot
Andy
The text was updated successfully, but these errors were encountered: