How do I debug a Worker Role using Remote Desktop with Windows Azure?
Asked Answered
C

5

7

I now have my Windows Azure environment set up so that I can access my Worker Role with Remote Desktop. However, I'm not sure how to proceed at the moment. After much digging I found a web site that was offline but in Google's cache there was mention of attaching to the Worker Role running in the Azure Cloud from the Visual Studio debugger. But I only have Visual Developer (not studio) 2010 and I have searched all over and as far as I can see there is no such option to attach to a remote server. I am able to publish my project to the Azure Cloud without error and I have a "healthy" instance of my Worker Role showing as active and running.

I did connect with RDP through the Azure Management portal. The login worked fine and up came the remote desktop window. I searched through much of what I could find and was unable to find my Worker Role. I must have the wrong impression of RDP, because I had hoped to see the Worker Role's main display form when I logged in, just like I do when I debug it locally in the Cloud Emulator. But instead all I saw was a blank desktop with some base level server inspection and management routines. I even checked the Event Viewer for Application related messages and saw none.

So now I'm stuck wondering if my Worker Role is actually running or not, despite the seemingly positive status messages from the Management Portal, and I still want to attach to my Worker Role for debugging through Visual Developer, if it's possible, but I am unable to figure out how.

Anyone with experience in this area that can give me some solid tips on what to do next, please respond.

UPDATE: I believe my worker role may be running because I opened a command window and did a Netstat and saw it listening on the correct port. However, that may just be my Worker Role shell class that starts the custom EXE I have it launch as a spawned proces. I still haven't confirmed if my custom EXE is running yet.

UPDATE-2: Just ran TaskList from a command window and the custom EXE is listed.

UPDATE-3: Everything is working as I just ran a remote test of the service so that's not a problem. Still want to know how to attach to the Worker Role from Visual Developer 2010 for remote debugging, and if it's possible to see the custom EXE's display form like I do when doing local debugging in the Cloud Emulator.

-- roschler

Connoisseur answered 4/7, 2011 at 23:40 Comment(3)
Do you have to connect using a debugger? Or is it enough to just see the messages?Broadcaster
@Anže Vodovnik - I'll take what I can get for now but eventually I'll need to debug I'd think. Also, please see my UPDATE note to my original post. If you don't see it yet it's because I haven't finished typing it.Connoisseur
Also, is it possible to see a remote screen presentation of my Worker Role main screen like I see when I debug it locally (does RDP do that)?Connoisseur
B
1

When you say:

But instead all I saw was a blank desktop with some base level server inspection and management routines.

this is exactly what you get with an Azure VM. It's a basic OS install, plus the bare minimum of Azure stuff it needs to run and the code you've uploaded. There's no fancy monitoring or health checks available on the machine by default, you're expected to have provided those yourself to have them available without having to RDP into the machine to check on it.

RDP is very good for tracking down certain problems, like checking that a startup task will run, checking which directories items are installed in and just generally being nosey. If you need extra tools to track down a problem, you can just install them while you're connected to the server. For example I have RDPed into a server and installed the Microsoft Debugging Tools, to track down a memory issue.

Brittan answered 5/7, 2011 at 1:26 Comment(3)
When I debug the custom EXE spawned by my C# Worker Role code locally, in the Cloud Emulator, it comes up with a display form that has a log window and a few other things; the main application screen if you will. This is the exact same behavior as if the EXE was run stand-alone. In other words, it is not a window-less background service or even a Console app. It's a full Windows GUI app. When I log into the RDP console I don't see the app's GUI, even though it is running fine. I am trying to find out why I don't see that GUI element and if there is a way that I can.Connoisseur
@knightpfor - Thanks for the Microsoft Debugging Tools link. If you know have a tutorial that shows how do the install with Azure and Visual Developer 2010, please let me know.Connoisseur
When you RDP into your VM, you do so as a particular user that you specified in the RDP setup. Your worker role does not run as this user though, it runs as one of the system accounts (I can't remember which one off the top of my head). So like any other RDP session, you don't get to see the desktop of other users.Brittan
P
4

There is a set of articles here which goes in length on how to set up for remote debugging in Azure:

http://blogs.u2u.be/peter/post/2011/06/21/Remote-debugging-an-Azure-Worker-role-using-Azure-Connect-Remote-desktop-and-the-remote-debugger.aspx

http://blogs.u2u.be/peter/post/2011/06/24/Remote-debugging-an-Azure-worker-role-using-Azure-Connect-remote-desktop-and-remote-debugger-part-2.aspx

http://blogs.u2u.be/peter/post/2011/06/26/Remote-debugging-a-Windows-Azure-Worker-Role-using-Azure-Connect-Remote-desktop-and-the-remote-debugger-part-3.aspx

The key takeaway is that you don't need to actually install Visual Studio on Azure, you only need to copy the Remote Debugger bits and then use Azure Connect to add your developer machine to the Virtual Network.

Pulque answered 3/2, 2012 at 17:8 Comment(1)
@UriMay: The blogs.u2u.be application sucks, but you can get the helpful content from the overal page view: blogs.u2u.be/peter/?page=2 and blogs.u2u.be/peter/?page=1Skipp
I
2

You can setup Remote Debugging with Visual Studio 2012
http://code.msdn.microsoft.com/Remote-Debugging-Windows-dedaaec9

Ioneionesco answered 11/10, 2012 at 6:10 Comment(2)
A little bit of a summary here would be usefulKeratoid
Windows Azure SDK 2.2 release adds support for remote debugging many types of Windows Azure resources. weblogs.asp.net/scottgu/archive/2013/10/22/…Ioneionesco
D
1

I suppose you could remote into your VM, install Visual Studio there, and debug the process...

I also suppose it might be possible to enable remote debugging (not sure what's involved there, but such a thing exists, and it works over TCP) and debug from a local instance of Visual Studio.

To my knowledge, neither is commonly done.

Dowson answered 5/7, 2011 at 0:28 Comment(4)
I have done remote debugging, but it was too slow to be practical. I think WinDebug would probably be the way t o go, but the learning curve is very steep.Pileate
Hello again @smarx. The web page I stumbled across that talked about this mentioned baking in some extra DLLs into the Worker Role. But I got the answer I was looking for. It's not practical. I still would like to be able to see my custom EXE's GUI which, for some reason, is invisible when I log in with RDP.Connoisseur
When you RDP in, you're not in the same GUI context as where your exe is running. (You're not even logged in as the same user.) I'm not even sure your exe has a GUI context for you to look at.Dowson
@smarx - Right. Forgot the simple fact that RDP isn't like an injected monitor program, but a separately logged in user, thanks.Connoisseur
B
1

When you say:

But instead all I saw was a blank desktop with some base level server inspection and management routines.

this is exactly what you get with an Azure VM. It's a basic OS install, plus the bare minimum of Azure stuff it needs to run and the code you've uploaded. There's no fancy monitoring or health checks available on the machine by default, you're expected to have provided those yourself to have them available without having to RDP into the machine to check on it.

RDP is very good for tracking down certain problems, like checking that a startup task will run, checking which directories items are installed in and just generally being nosey. If you need extra tools to track down a problem, you can just install them while you're connected to the server. For example I have RDPed into a server and installed the Microsoft Debugging Tools, to track down a memory issue.

Brittan answered 5/7, 2011 at 1:26 Comment(3)
When I debug the custom EXE spawned by my C# Worker Role code locally, in the Cloud Emulator, it comes up with a display form that has a log window and a few other things; the main application screen if you will. This is the exact same behavior as if the EXE was run stand-alone. In other words, it is not a window-less background service or even a Console app. It's a full Windows GUI app. When I log into the RDP console I don't see the app's GUI, even though it is running fine. I am trying to find out why I don't see that GUI element and if there is a way that I can.Connoisseur
@knightpfor - Thanks for the Microsoft Debugging Tools link. If you know have a tutorial that shows how do the install with Azure and Visual Developer 2010, please let me know.Connoisseur
When you RDP into your VM, you do so as a particular user that you specified in the RDP setup. Your worker role does not run as this user though, it runs as one of the system accounts (I can't remember which one off the top of my head). So like any other RDP session, you don't get to see the desktop of other users.Brittan
C
1

Based on other answers, you would be better off writing a log file to a local storage. You can read the file from RDP if you reallyhace to. Keep in mind, debugging on Azure isn't really simple, and rightly so.

What I was thinking though was, maybe you could run the process using the user's credentials. I can't verify at the moment, but you have a better shot of seeing the ui when you rdp.

Chickie answered 5/7, 2011 at 6:15 Comment(1)
Interesting idea on the user credentials. Sounds like though my very next project needs to be digging into local storage and then SQL storage. Hopefully Azure SQL isn't too different from MySQL.Connoisseur

© 2022 - 2024 — McMap. All rights reserved.