| Comments

Many have inquired if Silverlight Live Streaming had a replacement since the announcement of it being deprecated.  The SLS team blog pointed to Azure as a possible solution.  Since it doesn’t seem like anyone except James has really tried this, I decided to dust off my Azure account information and give it a try.

First, a note about SLS.  As I’ve said before I don’t think the offering was named very well from the start.  “Streaming” implies a specific technical connotation to most folks.  In fact, the media (or other files) hosted on SLS were never streamed as you might be thinking they were.  It was always a media file hosted on a content delivery network (CDN) and distributed delivered via basic progressive download…not streamed.  Now that we got that out of the way, let’s move on.

Setting up Azure

I’ll be honest.  I’m not sure how you go about getting an Azure token/invite at this point.  But you’ll need one.  Those who attended PDC08 already have access to one.  I believe MSDN subscribers will have access at some point but I don’t see it enabled on my account just yet either.  Bottom line is you’ll need an invitation token.  I cannot help you in this regard, so don’t even ask…I wish I could, but I can’t.

Once you have an Azure account, you want to create a Windows Azure Storage instance and give it a name.  I recommend not using special characters in the name as some of the tools I’m explaining below had problems with that.  I gave mine a simple name “timheuerblob1” and let it provision.

Azure Storage Account creation

Once you have that you’ll see a bunch of configuration screen details:

Azure configuration details

I’d recommend doing the following tasks first before you proceed.  In the bottom you’ll see an option to enable CDN.  For this purpose of hosting files/storage I recommend putting it on.  Additionally, this provisioning of CDN can take some time so do that first.  The next step is to configure your custom domain names (if you’d like) to map to the CDN and/or blob storage endpoints.  This is a simple/fast process but requires you to understand DNS entries and have the ability to modify your domain’s DNS information.  You can find step-by-step instructions at Steve Marx’s blog post here.  Without enabling this CDN feature, you really aren’t going to get the same level of scale as you did with SLS.

The key things you will need for the next part are the Primary Access Key and the Endpoints.  Make note of them.

Tools to upload content

Windows Azure blob storage is exactly what it says: storage.  Right now there aren’t any provided tools from Windows Azure to really manage the contents of the storage blob containers (unless I’m mistaken, and if so, please correct me).  There is an API for you to get access to and publish content, but if you’re wanting to use it like an SLS replacement you’re likely hoping for an easy tool to upload/manage the contents.

Enter two tools: Azure Storage Explorer and Cloud Storage Studio.  Both of these are Windows clients (WPF incidentally) and are installed on your machine.  Cloud Storage Studio actually has an online version if you wanted to use that offering.  I did not try that tool as I’m okay using a client tool.

Azure Storage Explorer is a CDDL licensed CodePlex project (which actually has no source code checked in at this point) provided by Neudesic – a Microsoft partner.  It is a simple UI that requires you to input your blob storage name, access key and endpoints in the Storage Settings dialog.  I initially had problems with this as my name had a special character in it.  I deleted my initial (and old) instance and recreated a new one in Azure and didn’t have problems after that.

Azure Storage Explorer screenshot

It was pretty simple to use and understand.  Create a container, upload stuff into it.  Done. 

Cloud Storage Studio is a commercial offering and unclear if it is going to be free always or just in CTP mode right now.  I couldn’t find information that jumped out at me on their site to let me know. 

Cloud Storage Studio screenshot

Cloud Storage Studio wouldn’t let me resize the window and that was frustrating.  Other than that it operated as expected, same thing – blob container select and upload.

While both tools were providing me basic blob container and upload capabilities, I felt the upload was slow (comparing to my Amazon S3 experience in creating a tool for content management).  I’m not sure if that was the app, Azure, or the nature of the API.  Also, neither tool seemed to enable me to set the content-type of the contents of the blob I was uploading.  I see this to be a problem for some.  The default of application/octet-stream isn’t going to work for all scenarios (for example I cannot use it to host XAPs and embed them because I would need to be able to set the content-type header).

Side note: Be sure to check out James Clarke’s CodePlex work on a Windows PowerShell script that will do encoding via Expression Encoder and then trigger a publishing plugin – such as one that will automatically upload to an Azure blob storage account.

Other than that, they served the need of filling the gap for a UI tool that already worked out the API stuff.

UPDATE: CloudBerry for Azure

I cannot believe I didn’t know about this one, since CloudBerry is what I use for my Amazon S3 storage and is AWESOME.  I was directed to CloudBerry for Azure Blob Storage (oddly by their competitor above) and I downloaded it immediately. 

CloudBerry Azure Blob Storage explorer

It met every expectation I had and has been the fastest client.  To me, the other clients must meet this bar of functionality *for blob storage interaction* to be considered for me to use.  The one thing it doesn’t have is custom CDN URI generation in its “WebURL” functionality – but I suspect this might be an Azure API limitation (I’m not familiar with the Azure API).

UPDATE 2: Cloud Storage Studio

Be sure to read the comments below from the team at Cloud Storage Studio.  They were kind enough to reach out to me to clarify some things above and listen to my feedback.  They are ACTIVELY looking to improve their product and provide value-add to Azure users/developers.  I sincerely appreciate when people reach out to their customers for feedback.  It’s been a great dialog with them helping them understand how I would use Azure and what my tools needs might be.

My Silverlight media test

Using my new found tools and some sample media files I uploaded a 720p high-def 30 second clip (30MB) to my blob storage account.  I then used put together a page with a simple player and pointed it to the Azure-hosted media.  I first pointed the media player to the basic blob endpoint.  The result of which is here: Non-CDN Hosted Media Playback.

Users who tested it with me said that the video buffered quite a bit and in remote areas (Australia) it took about 1.5 minutes to download the video.  This is again because this is still not streaming but just progressive download.

I then changed the media URL to the CDN version (after waiting 24 hours for propagation, etc. just to be sure) and have the CDN Hosted Media Playback.

I have to be honest and say that the CDN versions seemed to be better at consistent playback after the initial buffer of video (i.e., I received no more future buffering).  I’d be curious as to what other international people see on the CDN version as it would give a better view of how well the CDN delivers content globally.

Summary

I’m not sure if this will be a solution for everyone, but if you are looking for a Microsoft offering for cloud/CDN storage, give Azure a try.  NOTE: It is not a free service once it goes into production!  In fact, most CDN/cloud storage solutions you will find are not.  I’m currently using Amazon S3 for mine and have been for a long while.  It, too, is not free.  (Here’s the Amazon S3 CloudFront version of same media file.)  Again, here are the links to the three different video hosted locations/tests I did:

Either way, now that SLS is gone as a CDN/free hosted service where many were putting their media, you’ll have to look for another option.  Azure is one of those options.  Does it provide an automatic skin for a media player?  No.  You’ll have to do that yourself.  Is it streaming?  No, but neither was SLS.  Is there streaming/smooth streaming on the horizon?  I don’t know…but it would be cool if there was!

Hope this helps.

| Comments

At PDC09, Glenn Block delivered a great presentation on building extensible RIAs using the Managed Extensibility Framework (FT24 from the PDC09 sessions).  Glenn is one of the PMs and face-man for MEF.  He’s been traveling all around singing the praises of MEF for .NET developers and gathering feedback along the way.  You may remember Glenn from his work with the Prism framework as well.  I snagged Glenn at the end of PDC to grab a sound-byte:

Glenn has already started a series on MEF in Silverlight starting with the basics and then continuing along deeper.

These two initial posts are helpful to anyone who hasn’t started at all with MEF and understanding the value of implementing an extensible Silverlight application.  I know Glenn has more up his sleeves and I’ve been thinking on ideas with him as well (trying to learn MEF myself) so be sure to stay tuned for more excellent posts by Glenn on MEF and Silverlight!

| Comments

One of the cool features for Silverlight 4 Out-of-browser applications that was announced as a part of the Silverlight 4 beta release is the NotificationWindow class.  Most commonly referred to as “toast” these are the little notifications that popup in the system areas of your operating system to provide helpful (and sometimes annoying) information.  Any user of Microsoft Outlook no doubt has seen them.  They look something like this (Windows system tray area shown here):

Silverlight 4 NotificationWindow sample image

After reading Corey’s post showing a quick FAQ on customizing the experience of the NotificationWindow, I was drawn to the comment he made about queuing.  While the NotificationWindow API doesn’t have a queuing mechanism, .NET does and we can leverage that.

NOTE: For a simple overview with a short video and downloadable sample code in C# and Visual Basic about the Notification Window API visit this video: Notification API in Silverlight 4.

Let’s say you had some need to queue up notifications.  Or better yet, you really didn’t have a *need* to, but wanted to ensure that any notification you wanted to display would regardless of if a notification was currently showing, etc. – you want to make sure your notification hits.

Instead of just firing .Show() on your NotificationWindow, thing of using the Queue<T> class.  This enables a collection of items stored in sequential order and serves this purpose well.  Let’s assume a simple demonstration here.

We have an extremely simple UI with four buttons…each going to trigger a different NotificationWindow.  Here’s our XAML:

   1: <StackPanel x:Name="ApplicationSample" Visibility="Collapsed">
   2:     <Button Content="Notification One" x:Name="Notify1" Click="Notify1_Click" />
   3:     <Button Content="Notification Two" x:Name="Notify2" Click="Notify2_Click" />
   4:     <Button Content="Notification Three" x:Name="Notify3" Click="Notify3_Click" />
   5:     <Button Content="Notification Four" x:Name="Notify4" Click="Notify4_Click" />
   6: </StackPanel>

The button click logic looks the same for each (with the exception of passing in a different string of text to display):

   1: private void Notify1_Click(object sender, RoutedEventArgs e)
   2: {
   3:     CreateNewNotificationControl("Notification One");
   4: }
   5:  
   6: private void CreateNewNotificationControl(string NotificationText)
   7: {
   8:     NotificationWindow nw = new NotificationWindow();
   9:     nw.Width = 400;
  10:     nw.Height = 100;
  11:     nw.Closed += new EventHandler<EventArgs>(OnNotificationClosed);
  12:  
  13:     NotificationControl nc = new NotificationControl();
  14:     nc.NotificationText.Text = NotificationText;
  15:     nw.Content = nc;
  16:  
  17:     AddNotificationToQueue(nw);
  18: }

Notice the core function of CreateNewNotificationControl and the last line of AddNotificationToQueue.  This is the key function here.  Here is the code for the function:

   1: private void AddNotificationToQueue(NotificationWindow notification)
   2: {
   3:     if (_currentWindow == null)
   4:     {
   5:         _currentWindow = notification;
   6:         notification.Show(5000);
   7:     }
   8:     else
   9:     {
  10:         _notifyQueue.Enqueue(notification);
  11:     }
  12: }

In the code above _currentWindow is a NotificationWindow and _notifyQueue is a Queue<NotificationWindow> member variable.  We basically are adding the NotificationWindow objects we are creating to this collection and letting the Queue<T> help us manage what is showing when.  It is also key to note that when we do add a new NotificationWindow that we are attaching a Closed event handler that helps trigger the Dequeue function for our collection.

The end result is that we are essentially queuing up our notification windows.  Here’s a simple result of the code running (animated image):

NotificationWindow Queue demonstration

You can download the full code here: NotificationWindowQueue_CS.zip (C#) or NotificationWindowQueue_VB.zip (Visual Basic).  Remember, that NotificationWindow requires the application to run in Out-of-browser mode, so be sure to install it first!  Also, this requires Visual Studio 2010 and Silverlight 4 development tools to run.

This concept might come in useful for business applications where different functions (perhaps things out of view) need to notify the user of certain things.  Hope this helps think outside the box a little bit!

| Comments

If you’ve been working with Visual Studio 2008, Expression Blend 3 and Silverlight (or WPF) development, you’ve likely used the Open in Expression Blend feature in Visual Studio.  This occurs when you right-click on a XAML file in your project/solution and you’ll see that option as long as you have Expression Blend 3 installed.

Well…if you are an eager developer and have installed VS2010 and the Blend Preview for .NET 4, you may have noticed that integration broken.

Problem 1: VS2010 and Blend Preview for .NET 4 on a clean box – NO LINK

You’ve just fired up a new virtual PC or you have a clean install and you’ve installed Visual Studio 2010, the Silverlight 4 tools and Blend Preview for .NET 4.  You start your new XAML development project, add some code, then want to use Blend.  You right-click and see this:

Missing Open in Blend option

Nothing.  No option.  You miss that convenience of immediately opening the solution/file from VS to Blend and want it back.  You are confused because you have both installed!

Problem 2: VS2010 shows me the link, but it opens in Expression Blend 3

The other problem you may face is that you have VS2010, Blend 3 and Blend Preview for .NET 4 installed.  You see the Open in Expression Blend option, but when you click on it expecting it to open the latest Blend, it opens your VS2010 project in Blend 3 (or tries to) and fails.  You want to change this to open in Blend Preview for .NET 4.

Solution

I have a solution for you and luckily it is a fairly easy one. 

First, a warning that “here be dragons” – this is a registry editing procedure.  If you aren’t familiar with editing your registry, or don’t know what it is (highly unlikely), then you shouldn’t be doing this.  Screwing up your registry can cause irreparable damage and may harm small kittens in the process.  Seriously, you’ve been warned so don’t email me if your machine explodes into a pile of dust.  Hey, it works on my machine.

With the warning aside, here’s the fix.  Basically Visual Studio looks for a specific key in the HKLM (that’s HKEY_LOCAL_MACHINE to you registry noobs) for where to launch Expression Blend.  There is only one setting though, so this will apply for any VS instance you have installed.  Once you implement the registry setting you’ll see the option:

Open in Blend from Visual Studio

It is located in HKLM\Software\Microsoft\Expression\Blend – there is a key that VS is looking for there named “VS” with one String value named “BlendLaunchPath” which has the full path to the version of Expression Blend you want to launch.

   1: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Expression\Blend\VS]
   2: "BlendLaunchPath"="\"c:\\Program Files\\Microsoft Expression\\Blend Preview for .NET 4\\Blend.exe\""

So if you are missing the link or want to change the link that exists (because you are running Blend 3 and Blend Preview for .NET 4 side-by-side – which can be done if you didn’t know that) all you have to do is change that path.

Works on my machine logoI’m providing a ZIP file of the registry file you can merge (a .REG file) for both 32-bit or 64-bit (x64 is in the Wow6432Node) that will automatically add this setting for you assuming you have Blend Preview for .NET 4 installed in the default location.  You can get that ZIP file here: OpenInBlendRegHack.zip.

Hopefully this is a helpful little tip for you if you want to implement this integration between the beta of VS and the preview of Blend.  I use this integration a lot and it’s nice to have it working with the new tools and not miss anything.  REMINDER: Changing this registry change makes it changed for both VS2010 and VS2008...be warned.  Hope this helps!


This work is licensed under a Creative Commons Attribution By license.

| Comments

Last week, the Silverlight 4 beta release included the Silverlight 4 Tools for Visual Studio 2010.  This single installer would perform the following (assuming you had either Visual Studio 2010 or Visual Web Developer Express 2010 already installed:

  • Install a Visual Studio 2010 service pack (KB976272)
  • Install Silverlight 4 Windows developer runtime (4.0.1108.0)
  • Install Silverlight 4 SDK
  • Install WCF RIA Services (November 2009)

That is all you really needed.  But some may have had an experience afterwards of launching VS2010 and *NOT* seeing the WCF RIA Services Class Library or Silverlight Business Application templates:

WCF RIA Services Templates in VS2010

What is happening here is that likely you already had a version of .NET RIA Services (likely the July 2009 CTP) installed.  The Silverlight tools installer silently failed and just kept going.

If you don’t see the WCF RIA Services Templates…

If you don’t see the WCF RIA Services templates, make sure Visual Studio 2010 and Visual Studio 2008 are both shutdown and perform the following:

  • Go to the Add/Remove Programs control panel application and locate .NET RIA Services.  Select the item and uninstall it.  This will remove the previous July CTP of the artist formerly known as .NET RIA Services.
  • Re-run the Silverlight Tools for Visual Studio 2010 installer. This will re-install the items and ensure that RIA Services is properly installed
    • Optionally you can extract the RIAServices.msi installer by running the tools installer with the /x:<folder> switch which will extract the contents.

After performing the above, you should now see the WCF RIA Services templates and should be working fine.

So, what happened?  Why no fail log?!

We did say beta right? :-) -- In all seriousness, we wanted to ensure that the WCF RIA Services bits got in the tools installer and knew this little inconvenience might creep up for some.  Apologies for the inconvenience.  There also exists no logging of the failure to indicate that there was anything wrong and to assist you in knowing the situation.

This is being fixed in a future installer to detect a previous install of RIA Services and alert the user (or we may even force uninstall it…not sure yet). 

But wait, RIA Services isn’t working in my Visual Studio 2008 environment now!

That’s right.  If you install RIA Services for Silverlight 4/Visual Studio 2010, it isn’t going to work in your Visual Studio 2008 environment.  If you want to work on RIA Services with Silverlight 3 and Visual Studio 2008, then you need to stick with the WCF RIA Services for VS2008 version.

Bottom line: RIA Services does not install side-by-side.

All of this information is provided to you on the WCF RIA Services web site.  The first section explains the bits you need for each environment.

Hopefully this helps clear some confusion.  Yes, I know it is frustrating not getting an error and not seeing things work.  We’re working to solve that (doesn’t help you now, I know) in future setups and make sure the release tools installer does the right thing.  It’s during these beta periods we can help identify such issues to make sure we fix them before release.

If you have questions on WCF RIA Services, be sure to head to the forums where the team is listening!

Hope this helps!