0

Context

I need to find a way for my application to broadcast it's binding addresses through UDP without using IServerAddressesFeature.

I found a way to get my broadcast service running despite BackgroundService implementations launching before the routing is happening, but for some reason whenever i deploy my application IServerAddressesFeature will no longer provide me with addresses, while it reports the correct addresses at debug time.

Question

Is there some configuration option I can use to just parse the url's from there and skip past diagnosing the reason why the feature works at debug time, but not at deploy time?

Regarding potential answer

If you have a hunch why it won't work at deploy time feel free to let me know - I gave up on doing this through IServerAddressesFeature at this point and a configuration parsed approach would be good enough for me too.

Current implementation

Startup.ConfigureServices

... lots of configuration
applicationStateTransmitter.NotifyConfigurationDone();
applicationStateTransmitter.NotifyBindingAddressesAvailable(app.ServerFeatures.Get<IServerAddressesFeature>().Addresses);
... end of ConfigureServices

My service class used to bypass restrictions of the BackgroundWorker:

public class ApplicationStateTransmitter
{
    private readonly TaskCompletionSource _configurationDone;
    private readonly TaskCompletionSource<ICollection<string>> _bindingAddressesAvailable;

    public ApplicationStateTransmitter()
    {
        _configurationDone = new TaskCompletionSource(null);
        _bindingAddressesAvailable = new TaskCompletionSource<ICollection<string>>(null);
    }

    public Task ConfigurationDone => _configurationDone.Task;

    public void NotifyConfigurationDone() => _configurationDone.SetResult();

    public Task<ICollection<string>> BindingAddressesAvailable => _bindingAddressesAvailable.Task;

    public void NotifyBindingAddressesAvailable(ICollection<string> values) => _bindingAddressesAvailable.SetResult(values);
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dbl
  • 5,634
  • 3
  • 41
  • 66
  • [This](https://stackoverflow.com/questions/41908957/get-all-registered-routes-in-asp-net-core) stackoverflow post might help you. – TharinduSK Jul 11 '21 at 05:10
  • @TharinduSK sadly no - i know how to get routes, i need the ip endpoints – Dbl Jul 11 '21 at 20:23

0 Answers0