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

Confusing log when forwarding a port to a different port and omitting PortName #10

Open
congyiwu opened this issue Jan 31, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@congyiwu
Copy link

I built 90d1b45 Fix typo in RelayBridgeService.cs
All commands are in PowerShell in Windows 10

If I use a different port number in RemoteForward and LocalForward, the relay doesn't work, b/c PortName defaults to the port number, and the PortName on both sides won't match. This causes the request to be rejected:

if (remoteForwarders.TryGetValue(portName, out var forwarder))

In retrospect, it makes sense that PortName is required in my scenario, but there are no useful error messages for either the HTTP request that was made, or the relay logs on either end. I had to attach a debugger and step through the code to figure out what I did wrong.

I'd expect an error somewhere saying that PortName "8888" couldn't be found.

C:\Temp\client.yml:

LocalForward:
- RelayName: relayName
  ConnectionString: <connection string>
  BindAddress: 127.0.0.1
  BindPort: 8888

Client command line output:

& "C:\Program Files\Azure Relay Bridge\azbridge.exe" -f 'C:\Temp\client.yml'
info: azbridge[0]
      [1/31/2020 8:50:07 AM], RemoteForwardHostStart, 75b719c7-4155-42ae-9901-2cd466db3f3b,
info: azbridge[0]
      [1/31/2020 8:50:07 AM], LocalForwardListenerStart, 5200003c-46d1-462c-a4b5-a08b07e97806, { localEndpoint = 127.0.0.1:8888 }      info: azbridge[0]
      [1/31/2020 8:50:07 AM], LocalForwardBridgeStart, 1f7e24f4-0c1a-4f90-bb22-2201dfbb827f, { bindToAddress = 127.0.0.1, localForward = Microsoft.Azure.Relay.Bridge.Configuration.LocalForward }
info: azbridge[0]
      [1/31/2020 8:50:07 AM], LocalForwardHostStart, 9566fb1b-da5f-4518-9667-6ea663ab7a0d,
info: azbridge[0]
      [1/31/2020 8:50:34 AM], LocalForwardSocketComplete, e00e8d02-0bd9-475f-947b-4a7dad30d786, { endpoint = 127.0.0.1:8888 }
info: azbridge[0]
      [1/31/2020 8:50:34 AM], LocalForwardSocketClosed, e00e8d02-0bd9-475f-947b-4a7dad30d786, { socket = 127.0.0.1:8888 }
info: azbridge[0]
      [1/31/2020 8:50:35 AM], LocalForwardSocketComplete, 9fc504aa-6edc-41af-a183-f569e944715b, { endpoint = 127.0.0.1:8888 }
info: azbridge[0]
      [1/31/2020 8:50:35 AM], LocalForwardSocketClosed, 9fc504aa-6edc-41af-a183-f569e944715b, { socket = 127.0.0.1:8888 }

C:\Temp\server.yml:

RemoteForward:
- RelayName: relayName
  ConnectionString: <connection string>
  Host: neverssl.com
  HostPort: 80

Server command line output:

& "C:\Program Files\Azure Relay Bridge\azbridge.exe" -f 'C:\Temp\server.yml'
info: azbridge[0]
      [1/31/2020 8:50:05 AM], RemoteForwardBridgeOnline, bdabc540-b609-4723-9788-1e17596601ce, { hybridConnectionUri = sb://machinemanagementfa34a16.servicebus.windows.net/devfabric, tcpRemoteForwardBridge = Microsoft.Azure.Relay.Bridge.RemoteForwardBridge }
info: azbridge[0]
      [1/31/2020 8:50:05 AM], RemoteForwardBridgeStart, bdabc540-b609-4723-9788-1e17596601ce, { uri = sb://machinemanagementfa34a16.servicebus.windows.net/devfabric }
info: azbridge[0]
      [1/31/2020 8:50:05 AM], RemoteForwardHostStart, 25af2834-aa01-4303-97b8-9bda0b848726,
info: azbridge[0]
      [1/31/2020 8:50:05 AM], LocalForwardHostStart, 4d6446bc-bb61-4614-ab7f-417533819f66,

The HTTP request I tried to make:

wget http://127.0.0.1:8888 -UseBasicParsing
wget : The underlying connection was closed: An unexpected error occurred on a receive.
At line:1 char:1
+ wget http://127.0.0.1:8888 -UseBasicParsing
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
@clemensv clemensv added the enhancement New feature or request label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants