All Products
Search
Document Center

:What do I do if the error message "Because of a protocol error, this session will be disconnected. Please try connecting to the remote computer again" appears when I connect to a Windows instance by using Remote Desktop?

Last Updated:Mar 17, 2023

This topic describes how to resolve the following issue: The error message "Because of a protocol error, this session will be disconnected. Please try connecting to the remote computer again" appears when you connect to a Windows Elastic Compute Service (ECS) instance by using Remote Desktop.

Problem description

When you connect to a Windows instance, you are prompted with a protocol error and receives an error message.

Causes

This issue may occur because of various reasons, including the following ones:

Solutions

Use one of the following solutions to resolve the issue. In the following examples, an instance that runs Windows Server 2016 is used.

Solution 1: Modify the Remote Desktop session settings on the instance

  1. Connect to the Windows instance by using Virtual Network Computing (VNC).

    For more information, see Connect to a Windows instance by using a password.

  2. Right-click the image icon and select Run. In the Run dialog box, enter gpedit.msc to start Local Group Policy Editor.

  3. In the Local Group Policy Editor window, choose Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Security.

  4. In the Security directory, double-click Require use of specific security layer for remote (RDP) connections.

  5. In the dialog box that appears, select Enabled, set Security Layer to RDP, and then click OK.

  6. Run the following command to update Group Policy settings and apply the preceding configurations.

    1. Right-click the image icon and select Run. In the Run dialog box, enter cmd to start Command Prompt.

    2. Run the gpupdate command to update Group Policy settings.

  7. Connect to the instance again and make sure that the issue is resolved.

Solution 2: Change the port number used for Remote Desktop connections

  1. Connect to the Windows instance by using VNC.

    For more information, see Connect to a Windows instance by using a password.

  2. Right-click the image icon and select Run. In the Run dialog box, enter regedit to start Registry Editor.

  3. In the Registry Editor window, navigate to the following path:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp
  4. In the RDP-Tcp directory, double-click the PortNumber registry key.

  5. In the dialog box that appears, select Decimal in the Base section and modify the value in the Value data field. This field specifies the number of port that is used by Remote Desktop.

    Note

    Port 3389 shown in the preceding figure is the default port and is provided only for reference. Change the value to the number of port that you want to use for Remote Desktop.

  6. Use one of the following methods to restart the instance for the configurations to take effect.

    • Method 1: Restart the Windows instance in the ECS console. For more information, see Restart instances.

    • Method 2: On the instance, choose image > image > Restart.

Solution 3: Terminate the process that is occupying the port used for Remote Desktop connections

  1. Connect to the Windows instance by using VNC.

    For more information, see Connect to a Windows instance by using a password.

  2. Right-click the image icon and select Run. In the Run dialog box, enter cmd to start Command Prompt.

  3. Run the following command to view the ID of the process that is occupying the port used for Remote Desktop connections:

    netstat -ano |findstr 3389
    Note

    In this example, the default port 3389 is used for Remote Desktop connections. Specify the actual number of the port that you use for Remote Desktop connections.

  4. Run the following command with the obtained process ID (PID) to view the process that is occupying the port used for Remote Desktop connections:

    In normal cases, the port used for Remote Desktop connections is occupied by the svchost.exe process. If the port is occupied by a process that is not svchost.exe, the port cannot be used for Remote Desktop connections as expected.

    tasklist |findstr [$PID]
    Note

    Set to [$PID] to the PID that you obtained in preceding step.

  5. Run the following command to terminate the process and release the port.

    Important

    This step is a high-risk operation. Before you perform this step, make sure that terminating the process does not affect your business on the instance.

    taskkill /f /pid [$PID]
  6. Connect to the instance again and make sure that the issue is resolved.