March 12, 2010

Windows Azure CloudDrive - Creating a Web Role that mounts the CloudDrive from Azure Storage and reads text files (Part 2 of 2, 22 minutes)

This is part 2 of 2 screencasts I recorded that helps a Microsoft .NET developer use the new Windows Azure CloudDrive feature -

  • For Part 1, Creating a VHD and Uploading it to Azure Storage (Part 1 of 2, 30 minutes) – click here.
  • For the Summary entry on blog.ehuna.org, click here.

Once the VHD file has been uploaded to Azure Storage you can use the Azure SDK to cache it in your web role instance and mount it - you then have a NTFS hard-drive in the cloud where you can use the standard System.IO classes to read and write files. 

For more articles, screencasts and tips check out www.ehuna.org - follow me on twitter.com/ehuna

See below for details on what's covered in the video, and download the Visual Studio 2010 RC VB.NET sample projects used in the videos here:

  http://blog.ehuna.org/files/Visual-Studio-Solution-AzureSpeed1.zip (134 KB)

Continue reading "Windows Azure CloudDrive - Creating a Web Role that mounts the CloudDrive from Azure Storage and reads text files (Part 2 of 2, 22 minutes)" »


Windows Azure CloudDrive - Creating a VHD and Uploading it to Azure Storage (Part 1 of 2, 30 minutes)

This is part 1 of 2 screencasts I recorded that shows a Microsoft .NET developer how to use the new Windows Azure CloudDrive feature -

  • For Part 2, Creating a Web Role that mounts the CloudDrive from Azure Storage and reads text files (Part 2 of 2, 22 minutes) – click here.
  • For the Summary entry on blog.ehuna.org, click here.

In this video I go over the details on how to create a VHD file in Windows 7 and the code you need to upload it as a Page Blob in Windows Azure Storage.

I found the code that uploads the VHD to a Page Blob to Azure Storage in the cloud on Thomas Conte’s MSDN blog – thanks Thomas!  Also, thanks to Neil Mackenzie on the Azure forums who helped me out with many issues I ran into.

For more articles, screencasts and tips check out www.ehuna.org – you can also follow me on twitter.com/ehuna

See below for more details on what's covered in the screencast and download the Visual Studio 2010 VB.NET projects here:

  http://blog.ehuna.org/files/Visual-Studio-Solution-AzureSpeed1.zip (134 KB)

Continue reading "Windows Azure CloudDrive - Creating a VHD and Uploading it to Azure Storage (Part 1 of 2, 30 minutes)" »


January 28, 2010

How to speed up Windows Azure Development (Part 2 of 2, 9 minutes)

This is part 2 of screencasts I recorded that show how to speed up Windows Azure Development (see part 1 here). Specifically, in this screencast I show how we can create a macro in Visual Studio 2008 to attach or debugger to an IIS process.

We can then also create a keyboard shortcut for fast debugging of an Azure web role running in IIS. For more articles, screencasts and tips check out ehuna.org - follow me on twitter.com/ehuna

How to speed up Windows Azure Development (Part 2 of 2) from Emmanuel Huna on Vimeo.

Here’s what is covered in the video:

1. The rinetd trick and the RinetdService – accessing your windows azure web roles from the real IP (not 127.0.0.1). See “An easier way to access the Windows Azure local development fabric from another computer” -
  http://blog.ehuna.org/2009/10/an_easier_way_to_access_the_wi.html
2. Adding a breakpoint in Visual Studio 2008.
3. W3WP.EXE – the IIS host process.
4. Tools > Attach to process – takes forever for the list of processes to come up.
5. Attach to W3WP.exe the IIS host process.
6. Load the ASPX page in the browser and debug your code-behind.
7. Create a Visual Studio macro (Macros > Record Temporary Macro).
8. Rename and save the temporary macro.  Right-click and run.
9. Visual Studio > Options > Keyboard > Create keyboard shortcut.
10.  Change something in your code, right-click web role and build, press “CTRL+SHIFT+ALT+?” and open a browser to access your ASPX page.  Boom!  Debug your code in 1-2 seconds!
11. Attach to process when running a windows service or a worker role.
12. If using the ASP.NET custom session provider that uses Azure storage, don’t use it in development.  Set your web role instance count to 1 and store your ASP.NET sessions in proc.

Good Times!
Below you can find sample code and additional tips related to this screencast.

Continue reading "How to speed up Windows Azure Development (Part 2 of 2, 9 minutes)" »


How to speed up Windows Azure Development (Part 1 of 2, 18 minutes)

This is part 1 of 2 screencasts I recorded that show how to speed up Windows Azure Development (see part 2 here).   Specifically, in this screencast I create a sample Windows Azure project with one web role - but the web role is smart enough to load its settings when running the Azure fabric or not - allowing it to be hosted in IIS.

For more articles, screencasts and tips check out www.ehuna.org – you can also follow me on twitter.com/ehuna


Here’s what is covered in the video:

1. To get this working you need Microsoft Visual Studio and the Windows Azure SDK (November 2009 CTP) – you can get it here at -
  http://www.microsoft.com/windowsazure/windowsazure/
2. Create a new CloudService project (VB.Net) called “AzureSpeed1”, with an ASP.NET web role called “AzureSpeed1_WebRole”. 
3. Create a setting in the ServiceConfiguration.cscfg file.
4. Running the project in the Windows Azure local development fabric.  Benefits of running in a virtual machine.  A bit slower since we’re running in a virtual machine. 
5. Displaying a setting in the default.aspx page – web role still running in the local development fabric.
6. How I’m impatient – I’m used to years of RAD – Rapid Application Development with IIS, ASP.NET, VB.NET and Visual Studio.
7. You can run your web roles in the local development fabric – but you can also run them in IIS!  Make sure handle settings and logging properly.
8. Add new IIS site, match azure local development fabric and IIS ports (change by one number – e.g. 8080 and 9080).  Try loading the page and see the exception.
9. Knowing whether you’re running the Azure fabric or not.
10. Smarter function to read settings – if not running in the cloud from the web.config.
11. We’re back to RAD development!  Build your web role (really just an ASP.NET site) and start testing your ASPX pages – no need to run the local development fabric.
12. Conclusion: whenever you implement a feature in your Windows Azure projects, make sure you add support for running both in the Windows Azure fabric (local development fabric or Staging/Production cloud) or on-premise hosted in IIS.  Settings, logging, and ASP.NET sessions are examples of features that need to support both.

Below you can find sample code and additional tips related to this screencast.

Continue reading "How to speed up Windows Azure Development (Part 1 of 2, 18 minutes)" »


September 26, 2009

SQL Azure Overview - Part 3 (15 minutes)

This is the seventh in a series of videos on Windows Azure and SQL Azure – click here for the summary entry and a list of all 7 videos.

SQL Azure Overview - Part 3 from Emmanuel Huna on Vimeo.


86. Modifying the .netTiers templates to read the SQL connection string from Windows Azure configuration instead of Web.Config (or app.config).
87. How the code looks in the ASP.NET page - it doesn't change, it's the same "DataRepository.MyTableProvider" code we've used in the past.
88. Changes in the DataRepository.cst template - changing the ConnectionString collection.
89. Making sure all .netTiers templates use "connectionString" from this collection.
90. The process of creating custom features in CodeSmith templates: first make the changes in the code, then make the changes in the templates.
91. Details of what was executed to modify the .netTiers 2.3 templates to support reading the netTiersConnectionString from Windows Azure configuration using the Windows Azure SDK v1.0.  We now have a "IsConnectionStringAzure" property in the main NetTiers.cst templates!

Good times!


SQL Azure Overview - Part 2 (18 minutes)

This is the sixth in a series of videos on Windows Azure and SQL Azure – click here for the summary entry and a list of all 7 videos.

SQL Azure Overview - Part 2 from Emmanuel Huna on Vimeo.

72. Overview of CodeSmith (http://www.codesmithtools.com/) and my favorite ORM tool, .netTiers (http://nettiers.com/)
73. Important .netTiers configuration settings - source database, output directory, enterprise library version, executing the SQL, SQL Server 2005 database features, layer names, and SignAssembly.
74. Creating the Business Logic Layer (BLL) and Data Access Layer (DAL) for our previously TESTDB1 sample database.
75. The .netTiers report: which C# classes were created - with one table we got 64 objects + all of the Stored Procedures.
76. Compiling the generated business layer.
77. Copying the binaries (compiled DLLs) to a middle tier folder in source control.  Makes it easier for other developers to use our projects.
78. Adding references to the middle tier DLLs to your Windows Azure projects so they are properly deployed to Staging/Production.
79. The .netTiers SQL Client provider and configuration settings in Web.Config (or app.config).
80. Using .netTiers dynamic connections to connect to a SQL Azure database at runtime.
81. Sample ASP.NET page that uses DataRepository to bind records from sample table (TstMessages) in TESTDB1.  Also uses Ajax (update panel and trigger).
82. Idea: sub-classing the System.Web.UI.Page to automatically check if parameters are loaded, check on upgrades and create the .netTiers dynamic connection string.
83. Loading the netTiersConnectionString from Windows Azure configuration.
84. Using a short constant for the dynamic connection string name (to simplify the already elongated code).
85. .netTiers community forums and a thread I started on dynamic connection strings.  We get a tip on how to modify the .netTiers templates to add built-in support for Windows Azure and SQL Azure.

SQL Azure Overview - Part 1 (48 minutes)

This is the fifth in a series of videos on Windows Azure and SQL Azure – click here for the summary entry and a list of all 7 videos.

SQL Azure Overview - Part 1 from Emmanuel Huna on Vimeo.

52. Overview of SQL Azure.
53. Warning on name changes and confusing documentation (e.g. SQL Azure was previously called "SDS", SQL Data Services).
54. SQL Azure CTP limits: 5 databases, 10 GB per Windows Live Account.  MyCalyx Windows Live account: cloudservice2@calyxsoftware.com
55. SQL Azure Connection Strings for ADO.NET, ODBC, and OLE DB.  Our ORM of choice, .netTiers, uses the ADO.NET connection string.
56. The "sa" account in SQL Azure.
57. Using SQL Management Studio to manage SQL Azure databases.  SQL Azure server names, errors and warnings to currently ignore.
58. TDS - Tabular Data Stream protocol on port 1433.
59. Useful "manual" SQL statements.
60. Cleaning up SQL scripts for SQL Azure - including link to my blog entry.
61. Another blog entry I wrote with PowerShell scripts to clean up SQL scripts for SQL Azure: http://blog.ehuna.org/2009/08/windows_powershell_commands_to.html
62. Creating new databases in SQL Azure - having separate SQL Azure databases for Staging and Production.  Continue using on-premise SQL Server for development.
63. Types of SQL Azure databases when v1.0 rolls out: Web Edition (1 GB max, $9.99/month) and Business Edition (10 GB max, $99.99/month).
64. Creating a specific Login and User for every database (do not use the "sa" account).
65. Creating a sample database (TESTDB1) on an on-premise SQL Server 2008 Standard and deploying it to SQL Azure.
66. Important: you need at least one primary key - clustered index - before you can insert any records in a SQL Azure table (good and also works well with the .netTiers model).
67. Options to change in SQL Server Management Studio > TESTDB1 > Tasks > Generate Scripts (due to currently unsupported features in SQL Azure).
68. Handling SQL Azure timeouts in SQL Server Management Studio.
69. A better way: the new "SQL Azure Migration Wizard" released on CodePlex.  Installing it, configuring it and using it.  Automatic cleaned up scripts for SQL Azure including tables, stored procedures, primary keys, foreign keys, indexes, etc.
70. RedGate SQL Compare and my suggestion for a version that works with SQL Azure.  

Update 1/27/2010: David A. from Red Gate has announced that they now have an early access build of SQL Compare that works with Azure!  You can find the announcement at the bottom of this thread:

image

I highly recommend Red Gate’s SQL Compare – it’s an amazing product that has literally saved me hundreds of hours.  You can download a free trial here and request the SQL Azure early access build here: http://www.red-gate.com/Azure

Good Times!


71. Strategies for deploying a database on SQL Azure (first time) and options for schema changes and upgrades in future versions.


Windows Azure Overview - Part 4 (55 minutes)

This is the fourth in a series of videos on Windows Azure and SQL Azure – click here for the summary entry and a list of all 7 videos.

Windows Azure Overview - Part 4 from Emmanuel Huna on Vimeo.

39. Unhandled exceptions and custom errors in Web.Config.
40. Handling Upgrades: making sure the roles properly act when we are upgrading SQL Azure.
41. Loading a Windows Azure Storage Queue endpoint (QueueEndPointURI, AccountName, AccountSharedKey, StorageAccountInfo).
42. Creating a persistent and stateless Azure Storage Queue (QueueStorage and MessageQueue).
43. Adding an event to a queue in a web role.
44. Handling the event from a queue in a worker role.
45. Properly returning RoleStatus.Healthy or RoleStatus.UnHealthy in a worker's role GetHealthStatus() to allow for better monitoring of our role instances.
46. Considerations in removing a message from a queue when an error occurs (examples where message should be deleted and should not be deleted when sending out an email).
47. Logging Levels in the Development Fabric UI (Critical, Error, Warning, Information and Debugging).
48. Windows Azure Storage labs in the Azure training kit (to cover blobs and tables).
49. DNS considerations with Windows Azure URLs (CNAME entries).
50. Self signed SSL certificates for Windows Azure development (see Azure Links, OneNote required).
51. Adding purchased SSL certificates to your Windows Azure project.


Windows Azure Overview - Part 3 (20 minutes)

This is the third in a series of videos on Windows Azure and SQL Azure – click here for the summary entry and a list of all 7 videos.

Windows Azure Overview - Part 3 from Emmanuel Huna on Vimeo.

35. Using the Windows Azure forums and getting feedback from Microsoft employees.
36. Loading parameters when role starts.
37. Using reflection to log the role's version.
38. Page_Init() calls that should always be made.


Windows Azure Overview - Part 2 (63 minutes)

This is the second in a series of videos on Windows Azure and SQL Azure – click here for the summary entry and a list of all 7 videos.

Windows Azure Overview - Part 2 from Emmanuel Huna on Vimeo.

Note: we lost sound in the last 25 minutes - you get the Allman brothers instead.
15. Worker Role health status.
16. Custom ASP.NET Session provider that uses Azure storage - configuration in both Azure files and web.config/app.config.
17. Windows Azure portal.
18. Windows Live IDs and Azure CTP.
19. CS (Cloud Service) packages and Azure configuration.
20. Azure Storage Accounts.
21. Azure Staging and Production Environments.
22. Deployment IDs.
23. Staging DNS entries.
24. Upgrade/Run/Suspend/Configure/Delete commands.
25. Initialized/Running/Stopped/Paused role instance states.
26. Billing considerations when instances are deployed.
27. Azure Storage Manager.
28. Custom error pages in ASP.NET.
29. Azure training kit labs.
30. Azure links.
31. Azure Service Management API.
32. Azure SDK Tools documentation and CSPack/CSRun Azure command line tools.
33. Doing a Staging Upgrade.
34. Serving dynamic compressed content in Azure and bug on Microsoft Connect.