All Products
Search
Document Center

:Resolve RDP port conflicts on a Windows instance

Last Updated:Apr 28, 2026

Identify and resolve RDP port conflicts that prevent remote desktop connections to a Windows ECS instance.

Symptom

When you connect to a Windows ECS instance by using MSTSC on your on-premises device or Workbench in the ECS console, a session-disconnected error appears and the connection fails. The following figure shows a sample MSTSC error.Port conflict

Cause

Another process or service is using the default RDP port (3389).

Solution

Either terminate the process occupying the RDP port or change the RDP port number.

Important
  • Before you modify instance configurations or data, check the disaster recovery and fault tolerance capabilities of the instance. For snapshots, see Overview.

  • If you granted access permissions on or submitted sensitive information (such as usernames and passwords) in the Alibaba Cloud Management Console, modify the information promptly.

  1. Connect to the Windows ECS instance by using VNC.

  2. Identify the process using the RDP port. In this example, Windows Server 2022 is used.

    1. Open the Command Prompt window.

    2. Run the netstat -ano|findstr "3389" command to identify the process using port 3389.

      View port-occupying process

    3. Run the tasklist /FI "PID eq <PID that you obtained in the previous step>" command to view the process details. In this example, the tasklist /FI "PID eq 4176" and tasklist /FI "PID eq 7164" commands are run. In the output, svchost.exe is the RDP process and python.exe occupies port 3389.image

  3. Method 1: Terminate the process occupying port 3389.

    1. Run the taskkill /PID <PID of the process to be terminated> /F command. In this example, the taskkill /PID 4176 /F command is run.

      Important

      Understand the features of a process before terminating it. Stopping a key business or system process may cause a business interruption, system crash, or connection failure.

    2. Use MSTSC or Workbench to reconnect to the instance.

  4. Method 2: Change the RDP port number.

    1. Open Registry Editor.

      Registry Editor

    2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp, right-click PortNumber, and change the Value data to your desired port number.Modify tcp PortNumber

    3. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp, right-click PortNumber, and change the Value data to the same port number.

      Note

      The Value data for PortNumber must match in both the tcp and RDP-Tcp registry keys.

      Modify RDP-Tcp PortNumberWindows automatically recognizes the new RDP port number.

    4. Open the Services window.

    5. Right-click Remote Desktop Services and select Restart.Restart RDP service

    6. Configure security group rules to allow traffic on the new RDP port.

      To add a security group rule, see Add a security group rule.

    7. Use MSTSC or Workbench to reconnect to the instance.