Skip to content
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

WithLaunchProfile and 0.0.0.0 binding #3146

Closed
cliedeman opened this issue Mar 25, 2024 · 7 comments
Closed

WithLaunchProfile and 0.0.0.0 binding #3146

cliedeman opened this issue Mar 25, 2024 · 7 comments
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Milestone

Comments

@cliedeman
Copy link

I am testing a setup where I need a service to be exposed outside of localhost on other network interfaces.

launchSettings.json

{
    "profiles": {
        "http": {
            "commandName": "Project",
            "dotnetRunMessages": true,
            "launchBrowser": true,
            "applicationUrl": "http://0.0.0.0:5033",
            "environmentVariables": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },
        ...
    }
}

AppHost/Program.cs

var exposed = builder.AddProject<Project1>("project1")
  .WithLaunchProfile("http");

If I launch the app directly (without aspire) I can access it on non localhost ips but when launching with App host I can't access Project1 exception on localhost.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Mar 25, 2024
@mitchdenny mitchdenny added this to the Backlog milestone Apr 9, 2024
@mitchdenny
Copy link
Member

You could use the DevTunnels feature in VS?

@clarkezone
Copy link

I'm also hitting this issue. My linux box is joined to my tailscale tailnet, I want all the services to bind to 0.0.0.0 not localhost or 127.0.0.1 to permit correct routing over the talent. This works fine in a non-aspire .NET Core webapp by editing the http launch scheme replacing localhost with 0.0.0.0. In an empty aspire app with just the AppHost and ServiceDefaults projects, doing this for AppHost's launch profile:

"http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "applicationUrl": "http://0.0.0.0:15061", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "DOTNET_ENVIRONMENT": "Development", "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://0.0.0.0:19281", "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://0.0.0.0:20198" } }

results in:

dotnetaspire dotnet run -lp http --project dotnetaspire.AppHost/dotnetaspire.AppHost.csproj

Building...
Unhandled exception. System.AggregateException: One or more errors occurred. (DOTNET_RESOURCE_SERVICE_ENDPOINT_U
RL must contain a local loopback address.)
---> System.ArgumentException: DOTNET_RESOURCE_SERVICE_ENDPOINT_URL must contain a local loopback address.
at Aspire.Hosting.Dashboard.DashboardServiceHost.<>c__DisplayClass4_0.<.ctor>g__ConfigureKestrel|0(KestrelSer
verOptions kestrelOptions) in /_/src/Aspire.Hosting/Dashboard/DashboardServiceHost.cs:line 158
at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.UnnamedOptionsManager1.get_Value()
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.CreateServiceContext(IOptions1 options, ILogge rFactory loggerFactory, DiagnosticSource diagnosticSource, KestrelMetrics metrics) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl..ctor(IOptions1 options, IEnumerable1 transpo rtFactories, IEnumerable1 multiplexedFactories, IHttpsConfigurationService httpsConfigurationService, ILoggerFa
ctory loggerFactory, KestrelMetrics metrics)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstruc
tor)
at System.Reflection.MethodBaseInvoker.InvokeWithManyArgs(Object obj, BindingFlags invokeAttr, Binder binder,
[aspire] 0:[tmux]*

which is a showstopper for my use case.

@mitchdenny
Copy link
Member

We are currently trying to figure out how Aspire interacts with these various tunneling and VPN services. You can see some experimentation that I've done here around DevTunnels (#4771).

You could potentially take a similar approach by using the Tailscale CLI to spin up a reverse proxy to expose the .NET project to your tailnet.

@cliedeman
Copy link
Author

cliedeman commented Jul 10, 2024

@mitchdenny dev tunnels should probably get its own ticket. In my case it was a physical device connected to my laptop that I was testing with. So the tunnel based solutions don't apply

Ciaran

@mitchdenny
Copy link
Member

There already is ;)

@clarkezone
Copy link

@glennc fyi as we were discussing recently

@davidfowl
Copy link
Member

This was fixed #5588

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

No branches or pull requests

4 participants