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

can't connect to cluster error due to port 52323 but it's not a local port #628

Open
AnQueth opened this issue Apr 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@AnQueth
Copy link

AnQueth commented Apr 19, 2024

Describe the bug
I am getting the error just trying to run from vs 2022. I have no service using 52323, this port is on the cluster from the dotnet-monitor sidecar so it's not my port on a local machine.

2024-04-19T19:09:52.3472113Z | MindaroCli | TRACE | Event: Command.Start {"properties":{"Arguments":"connect --namespace dotnettest --service dotnettest-service --context masked-aks --local-port 5142 --env c:\users\aaron\appdata\local\temp\tmpc1c.tmp.env --script c:\users\aaron\appdata\local\temp\tmpc2d.tmp --control-port 61545 --ppid 63656 --elevation-requests []","IsRoutingEnabled":"false"},"metrics":null}\nOperation context: {"clientRequestId":null,"correlationId":"7e1c4366-e70f-4647-b924-5d46217217c2:5a4f5f04c435","requestId":null,"userSubscriptionId":null,"startTime":"2024-04-19T19:09:52.2749416+00:00","userAgent":"LPK/3.2.20240123.7-27a8263e VisualStudio/17.9.34728.123","requestHttpMethod":null,"requestUri":null,"version":"1.0.20240122.2","requestHeaders":{},"loggingProperties":{"ApplicationName":"MindaroCli","DeviceOperatingSystem":"Microsoft Windows 10.0.22631","Framework":".NET 7.0.15","MacAddressHash":"e8b7b1639dbec2fb5c39f93f0e3f2cb44143c6d39610bbb04edf927daede8448","ProcessId":15452,"TargetEnvironment":"Production","CommandId":"5a4f5f04c435"}}
2024-04-19T19:09:52.3948929Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: {"clientRequestId":null,"correlationId":"7e1c4366-e70f-4647-b924-5d46217217c2:5a4f5f04c435","requestId":null,"userSubscriptionId":null,"startTime":"2024-04-19T19:09:52.2749416+00:00","userAgent":"LPK/3.2.20240123.7-27a8263e VisualStudio/17.9.34728.123","requestHttpMethod":null,"requestUri":null,"version":"1.0.20240122.2","requestHeaders":{},"loggingProperties":{"ApplicationName":"MindaroCli","DeviceOperatingSystem":"Microsoft Windows 10.0.22631","Framework":".NET 7.0.15","MacAddressHash":"e8b7b1639dbec2fb5c39f93f0e3f2cb44143c6d39610bbb04edf927daede8448","ProcessId":15452,"TargetEnvironment":"Production","CommandId":"5a4f5f04c435","TargetServiceName":"dotnettest-service","IsRoutingEnabled":false}}
2024-04-19T19:09:53.0964607Z | MindaroCli | TRACE | Remoting started listening on 61545
2024-04-19T19:09:59.0338522Z | MindaroCli | TRACE | Connection established.\n
2024-04-19T19:09:59.7626031Z | MindaroCli | WARNG | Port 52323 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port.
2024-04-19T19:09:59.7626625Z | MindaroCli | ERROR | Port 52323 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port.\n
2024-04-19T19:09:59.7628687Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n
2024-04-19T19:10:00.5292117Z | MindaroCli | TRACE | Event: Command.End {"properties":{"Arguments":"connect --namespace dotnettest --service dotnettest-service --context masked-aks --local-port 5142 --env c:\users\masked\appdata\local\temp\tmpc1c.tmp.env --script c:\users\masked\appdata\local\temp\tmpc2d.tmp --control-port 61545 --ppid 63656 --elevation-requests []","Result":"Failed","FailureReason2":"Port 52323 is already in use on your machine. Please free this port and try again. Use \u0027netstat -ano\u0027 command to find which program is using this port."},"metrics":{"Duration":8203}}

@AnQueth AnQueth added the bug Something isn't working label Apr 19, 2024
@agobezy
Copy link

agobezy commented Jun 12, 2024

@AnQueth I found a fix for the issue. The port was being used by Hyper-V and removing the exclusion was the solution. The below steps are from https://dev.to/trademark18/an-attempt-was-made-to-access-a-socket-4nh9.

  1. Open CMD as admin > enter netsh interface ipv4 show excludedportrange protocol=tcp
  2. Find the port range for 52323
  3. Enter the command - net stop winnat
  4. Enter the command - netsh int ipv4 add excludedportrange protocol=tcp startport=52323 numberofports=1
  5. Enter the command - net start winnat
  6. Attempt the port forward again

Frustrating issue as the netstat command didn't show the port being in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants