Silverlight in the Mesh and the “Cloud” – Silverlight Mesh Enabled Web Application (Part 3)
Today I’ll talk about SMEWA (Silverlight Mesh Enabled Web Application) creation.
To create one (as for today) you need to be a member of Live Framework CTP. Invite to this CTP could be received through Microsoft Connect site.
After receiving the invitation key and redeeming it you will be able to download Live Framework SDK and Tools for Visual Studio and at Azure Services Developer Portal create new project – Live Framework CTP
After installing the Live Framework Tools for Visual Studio you will receive new project type (Live Framework) and will be able to create MEWA or SMWEA
I’ll create SMEWA. This creates 2 projects: one is actual Mesh Application, and another one is Silverlight application with references to 3 Live Framework DLL’s
Well, from here the things will be pretty easy (so I thought) and started to build my Cloud Store Management UI. I created pretty simple Silverlight application, which allows to see existing Blob objects, upload new file and delete exiting file. My UI final UI is looks like follows:
Giving the fact, that I created and tested all supporting web services already (in Part 2) the task was to create UI and connect it to those web services.
Well, I had the first “surprise” when tried to add reference to my “FileHandler” WebService (used web services description is here).
I’ve got proxy generation error:
Hmm… What is it… Why it failed?!?!? The test Silverlight app had no problem with it… I tried to learn from documentation, but frankly didn’t find any clear answer what is wrong. Here clearly stated, that “The Live Framework resource model is completely agnostic of any communication protocol or representation and no behavior is associated with the model. Live Framework resources, including FeedSync metadata, can be rendered to any wire format, such as POX, ATOM, RSS, or JSON.” So why not SOAP?
Well, I wanted to use existing services, so I had to find some solution… And I actually did – I removed 2 (out of 3) references to Live Framework and it worked:
Then I successfully added reference to my Cloud-based web service.
Basically, when I changed my WebMethods return parameters and input parameters to be simple .NET types (int, string, bool, etc. and not arrays, List<T>, etc.) I added the reference and called the WebService successfully.
Well – this was a small cheat, but what I will do in second SMEWA, when I will have to get the contents from the blob I just putted there and save it to Live Mesh Folder? Hmm… Stay tuned to the next part…
One small tip here – pay attention to web Service address being added to “ServiceReferences.ClientConfig”. You have to remove port (20000) before usage:
By removing the references to Live Framework I also lost an ability to use Live Services in my SMEWA. In next part I’ll deal with it also.
Actually, after all this trails with the management application I just removed created Silverlight application and added new standard Silverlight application. If you doing is you have to change references at Mesh Application also. When trying to debug this applications at the first time, you getting the dialog screen, which helps you to connect local application with Mesh Project:
The most important part there is Application Self-Link (it could be also added in Mesh Application project properties). After filling in the link Visual Studio upload the application to the Developer Mesh and opens it.
After my Silverlight application is loaded I’m executing asynchronous call to Web Service to get data:
//Create WebService SOAP Client
CloudStoreBL.FileHandlerSoapClient uploader = new ContentUploaderSilverlight.CloudStoreBL.FileHandlerSoapClient();
//Subscribe to completed events and handle returned data
uploader.GetFilesCompleted += (s, args) =>
if (null != args.Error)
txtDebug.Text = "Error occured (" + args.Error.Message.ToString() + ")";
txtDebug.Foreground = new SolidColorBrush(Colors.Red);
//assign returned results to list box
lst.ItemsSource = args.Result;
txtDebug.Text = "Ready";
txtDebug.Foreground = new SolidColorBrush(Colors.Blue);
//Perform the call
Here I got next problem – cross domain call exception. Well, it is pretty clear why I’m getting it – I’m running from https://developer.mesh-ctp.com/ and accessing web service at http://devcorner.cloudapp.net/.
All I have to do is to add clientaccesspolicy.xml to my Hosted Service:
After testing and debugging my SMEWA I was ready to upload it to the Mesh. I’ve uploaded the package and published the application:
All metadata about the application comes from Manifest.xml which is a part of package (and the Mesh Application project:
<?xml version="1.0" encoding="utf-8" ?>
The properties in the Manifest are applied when the application is uploaded through the Azure Services Developer Portal.
They are not applied when debugging or running the application from Visual Studio.
The following fields cannot be changed once the application is created:
If these fields are modified after the initial upload of the application, subsequent uploads will be rejected.
To successfully change these fields a new application must be created through the Developer Portal and
the new Application Self-Link must be copied into the application’s project properties in Visual Studio.
<Name>Cloud Store Content Manager</Name>
<Description>Cloud Store Content Management Application</Description>
Now I had to “install” this application to my Live Framework Mesh Desktop. I used “Install URL” from project properties page:
After giving myself permissions to use my application I created a new instance of it and gave it a name:
And now I had it on my Live Dsktop’:
Here the video of application execution:
Cloud Store Management SMEWA In Action
Well, this time I cheated a little bit – I created Silverlight application working in the Live Desktop instead of real SMEWA with Live Services access… Next time I will have no choice but to deal with the problem I had today.
Stay tuned to the next part – I will create the real SMEWA with my Live Mesh folders access – my downloader UI will save the contents from Blob to the “Cloud Store Content” folder at my Live Desktop.