• 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.

  • 相关阅读:
    Linux平台不同解压缩命令的使用方法
    poj 1274 The Perfact Stall
    Experience Design for Sexable Forum
    JavaScript中的Array对象方法调用
    iOS9适配小结
    [Servlet&JSP] HttpSession会话管理
    Android中的跨进程通信方法实例及特点分析(一):AIDL Service
    OpenCV——PS滤镜算法之Spherize 球面化(凸出效果)
    《Effective Modern C++》翻译--条款4:了解怎样查看推导出的类型
    Android开发系列之ListView
  • 原文地址:https://www.cnblogs.com/ericwen/p/RemoteDebugCloudService.html
Copyright © 2020-2023  润新知