This is the third part of the blog series of introducing some of the exciting new features of Windows Azure SDK 2.0. In this series I’ll take you on a tour of new Windows Azure SDK 2.0 features and experience them firsthand. You can find the SDK 2.0 announcement here. You can acquire SDK 2.0 through Web PI, or you can download it Windows Azure .NET Developer Center.
Previous parts:
Windows Azure SDK 2.0 Features (1) – A Even Better Server Explorer
Window Azure Web Sites has been one of the most popular services that new Windows Azure users have been enjoying. You can create a new web site in seconds and your web site is up and running in no time on one of the most advanced data centers of the world – for free! You can learn more about Windows Azure Web Sites on www.windowsazure.com. Ever since the beginning the service has been well known for its simplicity, speed, and friendly developer experience. Now, with Windows Azure SDK 2.0 provide you even better experiences by integrating Web Sites into Visual Studio Explorer, and providing live log data streaming right into Visual Studio.
Server Explorer Support
Yes! Now you can manage your Web Sites from Visual Studio Server Explorer as well!
Right-click on any web site to bring up its contextual menu:
From the menu you can perform common operations such as browsing to the web site, open management portal to manage the site, to stop/start the site, etc.
That’s something cool, but I won’t call it amazing. However, here’s something that will knock your socks off – right-click one of your Web Sites and select View Stream Logs in Output Window. Then, launch your Web Site and perform some operations. You can see your application tracing information in the output window – live! And you can also download the log files by clicking on download button (indicated by the arrow in the following screenshot). In my case the tracing information is in Chinese because I’ve been working on a couple of localization scenarios - but you get the idea!
More Diagnostics Support & Others
The log streaming feature is very cool indeed, but that’s not all the diagnostics support the team has put into this release. In this part of the article I’ll walk through you a small web site to experience other diagnostic features as well as some other improvements in this version of SDK.
- In Visual Studio 2012, create a new ASP.NET MVC4 Web Project (using Internet Application template).
- Before we publish the site, let’s modify the HomeController to trace each of the actions. For instance, add this line to Index() method (you need to resolve namespace for Trace ):
Trace.TraceInformation("Landed on home page");
- In solution explorer, right-click on the web site project and select “Publish…”.
- Click “Import…” to import publish profile. Hmm… now there pops a Import Publish Profile dialog, which allows you either to import a Web Site publish profile as before, or to import the profile from an existing site:
- After you’ve imported the profile, follow the wizard to finish publishing.
- Now refresh the Server Explorer, you should see your web site listed. Right-click on the site and select View Streaming Logs in Output Window from the popup menu.
- Navigate to different pages, and you’ll see your traced information appended to output window. The following shows in session I had with my test site. You can see the log messages, as well as inactivity reports before I stopped the streaming.
- Right-click on the site and click View Settings in popup menu.
- In the Configuration view, you can configure most of your web site settings here, and you can click on Full Web Site Settings to open Windows Azure Management Portal and directly land on the setting page of the site. You can see you can easily turn on and off web server logging, detailed error messages, as well as failed request tracing here. Our application log is current set to save to local file system with log level set to Information. You can also save your logs into your Windows Azure storage account. We’ll see how to do it next.
- Go to Logs tab. Click on Configure Logging link. This brings you to the management portal.
- Change APPLICATION LOGGING (STORAGE) to ON (I also changed LOGGING LEVEL to Information in this case). If you see this option disabled, that means you don’t have a storage account linked to this site yet. Go to LINKED RESOURCES tab and link to a storage account of your choice.
- Click manage connection button. Click on Synchronize primary key button and storage key is synced over – isn’t that sweet?
- Save your changes.
- Navigate through pages. And refresh the Logs tab to see latest trace entries:
Add a comment