Error : An item with the same key has already been added.
Opened this issue · 2 comments
When I use this in my config
Multiple listener binding:
- RelayName: myrelay
Bindings:
- BindAddress: 127.0.8.1
BindPort: 5671
PortName: amqps
- BindAddress: 127.0.8.1
BindPort: 5672
PortName: amqp
Full error
[04/01/2020 03:07:11], LocalForwardBridgeStartFailure, a7e16aeb-7c4f-4996-b5c3-f8b141099773, { localForward = Microsoft.Azure.Relay.Bridge.Configuration.LocalForward, exception = System.ArgumentException: An item with the same key has already been added. Key: sb://radica.servicebus.windows.net/myrelay
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value)
at Microsoft.Azure.Relay.Bridge.LocalForwardHost.StartEndpoint(LocalForward localForward, LocalForwardBinding binding) in C:\Users\Raynon\Desktop\AzureVPN\azure-relay-bridge-master4\azure-relay-bridge-master\src\Microsoft.Azure.Relay.Bridge\LocalForwardHost.cs:line 121 }
An item with the same key has already been added. Key: sb://radica.servicebus.windows.net/myrelay
I may have a simple fix for this.
change:
this.listenerBridges.Add(hybridConnectionUri.AbsoluteUri, tcpListenerBridge);
to:
this.listenerBridges.Add(hybridConnectionUri.AbsoluteUri + "-" + binding.PortName, tcpListenerBridge);
I'm working to validate this change, if it works I'll submit a PR.
👋 I'm hitting this as well. Is there anything in the proposed fix above that needs improvement, or can we push a PR through?