The SiteMonitR sample demonstrates how a Windows Azure Cloud Service and a Windows Azure Web Site can use SignalR to communicate in an asynchronous communication. The SiteMonitR Cloud Service pings all of the sites in a list of sites stored in Windows Azure Table Storage. As each site's status is obtained, it is sent over to a SignalR Hub housed in a Windows Azure Web Site. When the SignalR Hub receives notifications for a site, the Web Site's user interface is updated in real-time. The result is a web site monitoring application that provides up-to-date status of web sites, giving site administrators real-time data on how their sites are performing.
To get the site and cloud service running locally on a development workstation execute the following steps.
- Open Visual Studio 2012 as an Administrator (the Windows Azure SDK requires elevated priveleges to run the Windows Azure Compute and Storage emulators)
- Open the SiteMonitR.sln solution
- Press the F5 key to run the Cloud Service and Web Site simultaneously
- Use the HTML form to add a URL (include the "http://" in the text box)
- Observe as the site is monitored
- Add any additional sites and observe how they are monitored in real time
To get the site and cloud service running in Windows Azure, execute the following steps. A more comprehensive walk-through on setting up the entire application, see the Getting Started document for this sample.
- Log in to the Windows Azure portal.
- Create a new storage account to be used by the application.
- Create a new Cloud Service to use as the background service for the SiteMonitR application.
- Create a new Web Site to use to as the front-end web site for the SiteMonitR application.
- Go into the dashboard for the new storage account you created and click the Manage Keys button at the bottom of the portal. Copy the storage account's key to the clipboard.
- In Visual Studio 2012, expand the SiteMonitR.Azure project's Roles node. Double-click the SiteMonitR.WorkerRole node to open up the role's settings pane.
- Select the Cloud option from the Service Configuration drop-down menu.
- Click the ellipse button next to the SiteMonitRConnectionString setting.
- Enter in the storage account name and primary access key copied from the portal.
- Click the OK button.
- Repeat the same steps to set the Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString setting.
- Change the GUI_URL setting to reflect the URL of the Windows Azure Web Site you created using the Windows Azure portal.
- Right-click the SiteMonitR.Azure project and select the Publish menu item from the context menu.
- If you haven't yet imported your publish settings, click the Sign in to download credentials link in the publish dialog.
- Your web browser will open up and browse to the Windows Azure publish profile download page. When the page tries to download the publish settings file, click the Save button to save the file to your local workstation.
- Go back to Visual Studio 2012. Click the Import button in the publish dialog. Then, browse to the publish settings file you just downloaded and select it.
- Click the Publish button to deploy the Cloud Service to Windows Azure.
- The Windows Azure Activity Log window should open to display the Cloud Service's publishing process happening.
- Go back to the Windows Azure portal. Click the web site you just created to load the site's dashboard page.
- Once the site's dashboard loads in the browser, click the Download publish profile link.
- When the browser tries to download the file, save it to your local workstation.
- Right-click the SiteMonitR.Web project in Visual Studio 2012. Then select the Publish menu item from the context menu.
- Click the Import button on the publish dialog. Then, find the web site publish settings file downloaded from the Windows Azure portal.
- Click the Publish button in the dialog to publish the web site to Windows Azure.
- Once the site has been published, go back to the site's dashboard page in the Windows Azure portal. Click the Configure tab.
- Change the default document from Default.htm to Default.html. Then delete the other options from the list of default pages. Then, click the Save button to save the site configuration.
- Click the Browse button at the bottom of the web site's dashboard to browse the site.
- The site will open and present you with a simple form you can use to provide URL's of sites you'd like to monitor.
- Type in a site URL and click the Add Site button. The site will be added to the list of sites you are monitoring.
- Add in as many sites as you would like. All of the sites are monitored by the Cloud Service. Their status will update in real-time as the sites are hit by the service and reported in the web site. To remove a site, click the X button and the site will be removed from the list of sites monitored by the application.
For a more detailed walk-through on how to perform each of the individual tasks required to get this sample working in Windows Azure, see the sample's Getting Started document in the repository containing the code for the sample.