So a while back I blogged a little sample code on how to get some info about what’s happening inside your instance using a simple process within a web page.

Well, I decided to refresh this code sample using one of my favorite features, InputEndpoints!

So let’s take a quick tour of the sample. At a high level, this is what’s going on:

image

Let’s dig deeper. The client is a simple console app, and the service is a worker role that exposes a TCP InputEndpoint, connected to a socket. The socket accepts a single inbound client connection, and then executes commands on the local instance and returns the results to the client.

So, I can fire up my client and connect to my service like so:

image

And execute commands such as DIR or NETSTAT (or others you could try), against the local VM. This is very handy when trying to debug local instance issues.

You can download the code here. It contains the code for the VS2010 Worker Role cloud service project and the simple console client.

Also, you’ll need to update the diagnostics connection string before deploying it to the cloud, and I’d suggest deploying the worker role with a single instance to avoid any load balanced strangeness.

Enjoy :)

Technorati Tags: