Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

Windows Azure Platform 系列文章目录

 

  我们在开发Windows Azure的应用程序,虽然在大部分的情况下都可以使用Azure Emulator模拟器来模拟在云端计算节点(Azure VM)的执行结果,但是并不能100%模拟真正在Azure VM中的运行情况。开发人员更倾向于时间远程桌面来查看Azure VM,比如查看系统日志、临时文件等内容。Windows Azure SDK提供了对于Azure VM的远程桌面登录的支持,增强了用户体验。本章我给大家介绍一下相关的内容。

1.新建Azure Project(过程略)

2.发布Azure站点,选择项目-->右键-->Publish

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

3.在Publish Settings里选择"Enable Remote Desktop for all roles"

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

4.在弹出的配置"Remote Desktop Configuration"

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

  • User name:输入远程桌面的用户名
  • Password:输入登录密码
  • Confirm password:输入确认密码
  • Account expiration date:远程桌面功能的有效期

然后选择发布就可以了。

5.发布完成

  发布完成之后,我们可以看到除了Web Role默认的80端口Endpoint之外,Windows Azure还自动打开了3389端口,即远程桌面使用的端口。

6.配置远程桌面

  我们选中Role节点,可以启用和配置Azure远程桌面连接。

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

  

7.连接远程桌面

  我们选中Role下面的某个Instance节点,然后选择"连接"

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

会弹出一个关于rdp(Remote Desktop)的窗口,我们选择"打开"

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

在弹出的"远程桌面连接",我们选择"连接"

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

输入之前我们设置的用户名和密码,就能进入Windows Azure VM的桌面连接了。

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

  Windows Azure提供的云计算服务是PaaS,也就是Platform as a Service,所以已经预装好了OS(Windows Server 2008)和.Net Framework 4.0,如上图所示。

  接下来稍微浏览一下这台虚拟机。首先打开"我的电脑",可以看到Windows Azure VM包含三个盘符:C盘、D盘和E盘(我截图里有4个是因为mount上了Azure Drive)。

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

  • C盘保存了Windows Azure文件,包括配置文件、Local Storage文件和Diagnostic Monitor临时文件等
  • D盘是系统盘,包含操作系统、IIS和.NET Framework等
  • E盘存放的是应用文件,Worker Role和Web Role都会部署到这里。

在Visual Studio里,关于远程桌面的配置都是放在CSCFG文件里的

Windows Azure Cloud Service (21) 通过远程桌面功能访问Windows Azure 计算节点

 

使用远程桌面的时候需要注意:任何保存在Windows Azure VM盘符的内容都是临时的、非持久化的。比如,我通过Windows Azure VM在D盘新建了一个txt文件,这个文件不会一直被保存。因为某些特殊情况,VM节点会宕机(系统升级、物理损坏)等,后台Fabric Controller会把该VM下的Web Role和Worker Role的内容迁移到同一数据中心的另外一台机器上,但是不会自动迁移D盘新建的txt文件!如果需要保存持久化的内容,一定要使用Windows Azure Storage,切记切记!


本文转自Lei Zhang的博客博客园博客,原文链接:http://www.cnblogs.com/threestone/archive/2012/03/07/2384046.html,如需转载请自行联系原作者