man-group / dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
Apache License 2.0
175 stars 21 forks source link

reserving port for AppPort? #25

Closed aktxyz closed 2 years ago

aktxyz commented 2 years ago

I love the auto port assignment stuff.

Is there a way to get that working with the actual port the app is listening on?

The log output below shows the AppPort is a preferred port, coming from launchSettings.json. But even when I remove applicationUrl from launchSettings.json, it still logs out "preferred port"?

[14:10:24 DBG] Assigning preferred port 5020 for option AppPort
[14:10:24 DBG] Reserving new port 50001 for option DaprGrpcPort
[14:10:24 DBG] Reserving new port 3500 for option DaprHttpPort
[14:10:24 DBG] Reserving new port 9090 for option MetricsPort
[14:10:24 DBG] Reserving new port 7777 for option ProfilePort
badgeratu commented 2 years ago

If you don't specify an override AppPort in appsettings.json, Sidekick automatically obtains the value from the ASP.NET Core hosting process - you can see that here. Sidekick has no control over the port assignment used by ASP.NET Core - you specify that for your application either in launchsettings.json or via the usual IConfiguration mechanisms. All Sidekick does it try to automatically identify what you or ASP.NET Core have defined as the port the application is using.

So when it is writing out Assigning preferred port... that means it has extracted a pre-defined port either from a user-defined override or from the ASP.NET Core hosting process. In your example ASP.NET Core has assigned port 5020 to the application hosting endpoint, so Sidekick will attempt to connect Dapr to that port.

I'm curious though why you asked the question - is there something unexpected happening?

badgeratu commented 2 years ago

Hi @aktxyz we haven't heard from you on this, so we're closing the issue. Please re-open it if you need :)