This post by adamab originally appeared last Friday, July 15, 2011 on the AppFabric Team Blog.
In the previous blog post on developing AppFabric Applications, we showed you how to create a simple AppFabric application. This app was an ASP.NET web site that used a SQL Database. In this blog post, we’ll use the AppFabric Application Manager to configure, deploy, and monitor that application. Here is a breakdown of what we will cover:
- The AppFabric Player application has been imported (where the last blog post left off). Package can be downloaded here (AppFabricPlayer.afpkg).
- Update the connection string to point to a SQL Azure database
- Initialize the SQL Azure Database with application data
- Deploy and start the application
- View aggregate ASP.NET monitoring metrics at both web app and web page granularities
Before we can do those things, we’ll sign into the AppFabric LABS Portal at https://portal.appfabriclabs.com using our Live Id. Since this is a limited CTP, only approved users will have access to the service, but all users can try the SDK and VS Tools on your local machines. To request access to the AppFabric June CTP, follow the instructions in this blog post.
After signing in with an approved account, we click on AppFabric Services in the bottom left corner and then select Applications from the tree view.
Now we can start with our first task, updating the connection string to the SQL database that is used by the AppFabric Player app. Users of the AppFabric June CTP are provided with a SQL Azure database at no charge. We will use this database. To get access to our SQL Azure connection string, we’ll click on the database in the main panel and then click View under Connection String. The resulting dialog lets us copy the connection string to the clipboard.
Now we’re ready to go to the Application Manager. We select our namespace from the main content area and then click Application Manager on the ribbon.
We can also reach the Application Manager directly by using a URL in this format: https://yournamespacehere.appmanager.appfabriclabs.com.
We click on AppFabricPlayer to manage that app.
Then we’ll click on Referenced Services in the Summary area.
Then we’ll click on the VideoDb link to configure the database. Now we will update the connection string using the value we copied earlier. Note that the DatabaseName and the ServerConnectionString fields are separate so you will have to remove the database name from the value before pasting it in.
Before Data Source=myservername;Initial Catalog=mydatabase;User ID=myuserid;Password=mypassword
After Data Source=myservername;User ID=myuserid;Password=mypassword
We update both fields and select Save.
Next we will create and populate the SQL table that this app expects in the database. We’ll go to https://manage-sn1.sql.azure.com/ to do that. We login with the same credentials that appear in our connection string.
We’ll click on New Query from the ribbon and paste in the SQL script below. We execute the script and the database is initialized.
CREATE TABLE [dbo].[AppFabricVideos] (
INSERT INTO [dbo].[AppFabricVideos]
Now that the database is ready we can deploy and start our application. We go back to the Application Manager and navigate to the AppFabric Player’s Application Page. From this page, we’ll click on Deploy Application and then accept the dialog.
Once the application state changes to Started we visit the site. To do this, we’ll click on Endpoints in the Summary area and then select the app’s Published Address link.
Now that the app is running we are able to monitor important activity. To simulate activity we wrote a load test that hits the web page once every second or so. If we go back to the application page and click on Monitoring in the Summary area, we’ll see some interesting metrics.
These metrics are aggregated at the application level, but if we drill down into the ASP.NET Web Application we can see more granular metrics. We click on Containers in the Summary area and then select Web1, which represents our one and only service group. We then click on PlayerWeb, which represents our ASP.NET Web Application. We then click on Monitoring from the Summary area.
Our breadcrumb bar now indicates that we have navigated into the PlayerWeb ASP.NET Web Application. From this view, we can see exactly how many times each file in the web application has been requested as well as the average request latency for each.
And just like we saw at the application page, we can expand each row to display a chart to see how each value has changed over time.
That’s it. In this post we showed how to configure, deploy, and monitor and AppFabric application using Application Manager. In future posts, we’ll cover troubleshooting, extensibility, and more. Stay tuned.