简体   繁体   中英

Remote Desktop “can't connect to the remote computer”

I have followed this tutorial to create the first azure application http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_IntroToWindowsAzureLabVS2010

Because after deployment its not working on the following url http://24fb8b6a055d4ab2a556218f62d6dbe1.cloudapp.net/

I found the following link helpful to connect via remote desktop to be able to see the error: http://wely-lau.net/tag/remote-desktop/

However, after following all steps, I get the following error

Remote Desktop can't connect to the remote computer for one of these reasons:

1) Remote access to the server is not enabled
2) The remote computer is turned off
3) The remote computer is not available on the network

Make sure the remote computer is turned on and connected to the network, and that remote access is enabled.

In: ServiceConfiguration.Cloud.cscfg

I have this contents

<?xml version="1.0"?>
<ServiceConfiguration serviceName="GuestBook" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
  <Role name="GuestBook_WebRole">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=luisvalenciaguestbook;AccountKey=x" />
      <Setting name="DataConnectionString" value="DefaultEndpointsProtocol=https;AccountName=luisvalenciaguestbook;AccountKey=x" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="levalencia" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="x" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2012-12-16T23:59:59.0000000+01:00" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="x" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
  <Role name="GuestBook_WorkerRole">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=luisvalenciaguestbook;AccountKey=x" />
      <Setting name="DataConnectionString" value="DefaultEndpointsProtocol=https;AccountName=luisvalenciaguestbook;AccountKey=x" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="levalencia" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="x" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2012-12-16T23:59:59.0000000+01:00" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="x" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
</ServiceConfiguration>

By default Remote Desktop for Azure uses the usual TCP port 3389: you'll need to have this enabled outbound at your corporate firewall.

An alternative approach to setting up Remote Desktop through the configuration files directly or through Visual Studio is to use the Azure Management Portal to modify them temporarily. This is rather easier and somewhat less error prone, especially where certificates are concerned.

Sign in to the management portal as usual, and choose "Hosted Services". Then find the service you'd like to configure.

The next step is to configure the Web Role or Worker Role to allow Remote Desktop connections: this will adjust the configuration file for the service, so any changes here will be lost when you next upgrade or reimage. Select the role, then in the toolbar ensure "Enable" is checked on, and choose Configure:

在此输入图像描述

You'll be prompted for the username, password, certificate and expiry time.

Choose OK. If you've made changes to the configuration it can take a little while (sometimes several minutes) for them to be applied.

Once the instances are marked as "ready" again, you can then select one and choose Connect:

在此输入图像描述

This will download a file with the extension .rdp , which you can then open to connect to the remote host. (You will most likely see some security warnings when you do so.)


If you still see the warning about being unable to connect to the remote host then there are a couple of things to explore: certificates and firewall issues. In my experience the "manual" process, configuring the remote desktop settings in Azure through the portal, usually gets around any issues with certificates.

Firewall issues are harder to resolve. You may find that using Windows Azure Connect -- which in essence creates a secure VPN connection from your PC to the Azure instances -- allows you to access the Azure host directly, tunnelling across your corporate firewall.

All the above didn't work for me.

Enter your credentials, prefixed with . Eg “\\maarten”. This is done to strip off the Windows domain from the credentials entered.

Its somehow strange that is not documented anywhere and it should be stripped off by the windows azure RD manager !

I had this problem and nothing worked, I couldn't Remote Desktop in even though the role was fully working.

It turns out there is a known issue with Azure SDK 1.7 and 1.8. Here is the info I received from Microsoft:

A timing issue in a role startup in SDK versions 1.7 and 1.8 sometimes causes a firewall rule required by the Remote Forwarder Service to be deleted. Restart of the service will correct the problem and recreate the firewall rule but this is not a persistent fix. Any redeployment or restart of the role instance may cause the problem to reoccur.

Work Around:

Azure application developers can implement a custom startup task that refers to a *.cmd file (eg RemoteForwarderConfig.cmd) as described below. This will ensure a firewall rule is created that opens ports for the Remote Forwarder Service. This startup task should be added to the role designated for running the remote forwarder.

Documentation on startup tasks is available at http://msdn.microsoft.com/en-us/library/windowsazure/gg456327.aspx

Example task config:

<Task commandLine="RemoteForwarderConfig.cmd" executionContext="elevated" taskType="background"></Task>

Example task cmd file contents:

@echo off
netsh advfirewall firewall add rule name="RemoteForwarderService custom rule" description="Allow incoming connections to the remote forwarder" dir=in protocol=tcp program="%ProgramFiles%\Windows Azure Remote Forwarder\RemoteForwarder\RemoteForwarderService.exe" action=allow enable=yes

If you are exposing a https endpoint, make sure you also expose an http endpoint . This solved the same issue for me with a data service I am hosting in a webrole.

I had this issue and couldn't figure it out.

Turned out the password wasn't complex enough however it didn't inform me of this at any point. Adding a more complex password and logging in with \\YourUsername sorted it for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM