zoukankan      html  css  js  c++  java
  • How to use VS2012 remote debug Windows Azure Cloud Services

    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.

  • 相关阅读:
    [UOJ#128][BZOJ4196][Noi2015]软件包管理器
    [UOJ#127][BZOJ4195][NOI2015]程序自动分析
    [BZOJ3653]谈笑风生
    Django 数据库查询优化
    C#中引用(ref关键字)参数
    C#中值参数的使用实例
    静态变量和实例变量
    全局变量和局部变量的理解
    C#方法定义和调用-2
    C#函数的方法定义和方法调用小议
  • 原文地址:https://www.cnblogs.com/ericwen/p/RemoteDebugCloudService.html
Copyright © 2011-2022 走看看