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.

  • 相关阅读:
    Setup VSFTPD Server with Virtual Users On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3
    C++ xmmp IM开发笔记(一)
    getting “fatal: not a git repository: '.'” when using post-update hook to execute 'git pull' on another repo
    Bad owner or permissions on .ssh/config
    CentOS6.3安装VBoxAdditions
    仿春雨医生 安卓app(android)
    centos git gitolite安装笔记
    存储过程编译报错如何解决
    冒泡排序
    ORACLE WITH AS 用法
  • 原文地址:https://www.cnblogs.com/ericwen/p/RemoteDebugCloudService.html
Copyright © 2011-2022 走看看