How to use VS2012 remote debug Windows Azure Cloud Services

本文介绍如何在Windows Azure Cloud Services中实现远程调试。主要包括安装Visual Studio 2012 IDE、远程机器上安装Remote Tools for Visual Studio 2012 Update 2等步骤,并详细说明了如何通过代码在角色启动时安装远程调试工具。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Background:

Windows Azure Cloud Services 可以在本地调试,使用Visual Studio 2012 + 模拟器 Emulator。但是模拟器的工作状态和环境和真实的云环境还是有区别的。

所以有些问题,需要远程调试(Remote Debug)

Steps:

1、Local :Install IDE Visual Studio 2012 at local

2、Remote Machine:远程机器需要安装Remote Tools for Visual Studio 2012 Update 2

  下载地址:rtools_setup_x64.exe 选择正确的操作系统版本(32位的工具只能Debug 32位的程序,64位的调试64位程)。

Note:一般远程调试,准备上述就可以了。Cloud Service的Instance安装Remote Tools可以放在Setup WebRole 或者WorkRole 的时候同时安装Debug工具。

3. Upload rtools_setup_x64.exe to storage blob container named "Tools".

4. Cloud Service

1)Create Cloud Service with a webrole instance(asp.net mvc4 with empty template).

2) Write code to install Remote Tools in Role OnStart method. Will be attached the detail code about how to implement method StartStopDebugService().

   public override bool OnStart()

        {

            // For information on handling configuration changes

            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

 

            RoleEnvironment.Changing += RoleEnvironmentChanging;

            RoleEnvironment.Changed += RoleEnvironmentChanged;

 

            try

            {

                StartStopDebugService();

            }

            catch (Exception ex)

            {

                //Trace Startup Exception

                Trace.TraceError(ex.Message);

 

                throw;

            }

 

            return base.OnStart();

        }

 3)Configuration

Double click webrole under cloud service porject to edit properties.

Settings:

 Endpoint:

The endpoint RemoteDebugger with public port 4016 is used for local Visual Studio connecting to the remote debugger process.

Local Storage:

When web role starting, it will download remote tool from storage blob contrainer to local storage, and then install it. 

   

5. Publish cloud service

Configurate publish settings with default.

6. Debug

1) Open website of the cloud service

2) Set breakpoints in VS

3) Open Debug->Attach to process

if w3wp.exe process doesn't in the available prcesses list, please refesh website.

   

7. Source Code

WindowsAzureRemoteDebug.zip

I have removed reference packages from the solution, if you want build successfully, you should add them yourself.

7. Enjoy debuging.

If you have any question, feel free to ask me by repling comment.

转载于:https://www.cnblogs.com/ericwen/p/RemoteDebugCloudService.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值