Sunday, October 23, 2011

Unity Windows Azure Settings Injector

This is my first combined CodePlex / NuGet package contribution. This small piece of code is meant to help those of you who are using Unity as Policy Injection / DI framework and are considering moving to the cloud.

This project includes auto resolver for following Windows Azure Configuration Settings:

  • LocalStorage
  • Setting (both string setting and Azure Storage Connection string)

The source code is located at CodePlex: http://uasi.codeplex.com while the single line installation is located at NuGet:

PM> Install-Package UASI

The NuGet package will automatically add references to Unity assemblies (if not already added), to UASI assembly, and will make necessary configuration changes to your web.config / app.config file. It will also add (commented out) the following simple usage scenario for your project:

<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<
sectionExtension 
type="Unity.AzureSetting.Injector.SectionExtensionInitiator, UASI"
/>
     <!--
Bellow is sample usage of package –
>
     <
container
>      
<
register type="IStorageHelper" mapTo="StorageHelper"
>
<
lifetime type="singleton"
/>
         <
constructor
>
           <
param name="connectionString"
>
             <
azureSetting
              key="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString"
              type="ConnectionString"
/>
           </
param
>
         </
constructor
>
         <
property name="RootFolderName"
>
           <
azureSetting key="LocalStore" type="LocalStorage"
/>
         </
property
>
       </
register
>
     </
container
>
</
unity>

Hope that it will work smoothly with your projects!


What to expect:


In the project roadmap are implementations for IPEndPoint resolver (for both Internal / External EndPoints) and some real sample usage showcase.


Stay tuned for updates.

Friday, October 21, 2011

ServiceReference.ClientConfig build management in Silverlight projects

I’ve blogged a before for web.config transformations and how I would like to see them in other projects. While for Windows Azure cloud service project there is already similar feature implemented, I wonder why there is no out of the box support for other project types.

Here I will reveal the powerful, yet simple implementation of such transformation over your ServiceReferences.ClientConfig files. Thus you will no longer wonder what are your service endpoints, and which endpoint you are using. And this is not Windows Azure specific. It is relevant for any Silverlight project.

Just implement these simple steps:

1. Edit your .csproj file of the Silverlight application. Add the following block:

<UsingTask TaskName="TransformXml"

   
AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"
/>
   <
Target Name="BeforeBuild"
Condition="exists('ServiceReferences.$(Configuration).ClientConfig')">
     <!--
Generate transformed app config in the intermediate directory –
>    
<
TransformXml Source="ServiceReferences.ClientConfig"
      Destination="$(TargetDir)\ServiceReferences.ClientConfig"
      Transform="ServiceReferences.$(Configuration).ClientConfig"
/>
     <!--
Force build process to use the transformed configuration file from now on. –
>
     <
ItemGroup
>
       <
Content Remove="ServiceReferences.ClientConfig"
/>     
<
ContentWithTargetPath 
Include="$(TargetDir)\ServiceReferences.ClientConfig"
>      
<
TargetPath>ServiceReferences.ClientConfig</TargetPath
>
       </
ContentWithTargetPath
>
     </
ItemGroup
>
   </
Target>

right after:

 <Import 
Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />

2. Add new XML file to your project. Name it ServiceReferences.[BuildConfiguration].ClientConfig. Where [BuildConfiguration] can be the name of *any* build configurations you have defined for your project. The default build configurations are “Debug” and “Release”, but you may add as many as you like, to suit your development/testing/staging/live environments. Remember to set “Build Action” to “None”, and “Copy to output directory” to “Never”:



3. Add the required content in that custom file. For example, if you want to just change an endpoint for a service, you will have something like this (ServiceReferences.Debug.ClientConfig):

<?xml version="1.0" encoding="utf-8"?>
<
configuration
  xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"
>
     <
system.serviceModel
>
         <
client
>
             <
endpoint 
address="http://127.0.0.1:81/DummyService.svc"
xdt:Transform="SetAttributes"
/>
         </
client
>
     </
system.serviceModel
>
</
configuration>

For more information on XML transformations supported, please take a look at the MSDN documentation for Web.Config transformations. Do not panic! The documentation is for “web.config” transformations, but these are just XML transformations that can transform any XML file Winking smile

Move Silverlight applications to the Cloud

While moving a typical ASP.NET application to the cloud might require more actions, and would have more “points of break” when moving to the cloud, a Silverlight application is much more amenable to move to the Cloud.

At last Windows Azure User group meeting we covered most common scenarios of Silverlight applications and moved them to Windows Azure. We had a Silverlight application communicating with WCF Services, application that uses WCF RIA services, and application that uses Media services (video player). We moved entire application into the cloud and showed how one can leverage the Windows Azure CDN to achieve better user experience in terms of application load.

Here you can find the source files for the Demos I used: http://bit.ly/okjFNn 

Here you can find the slides: http://bit.ly/nugWoP

The TCP Server I used for the demos is based on “A very basic TCP Server written in C#” article in CodeProject. Second TCP demo (SilverCloudBase_05_Sockets_Adv) is a bit edited version of that server, to support message broadcasting to all connected clients.

The session recording will be available soon, so stay tuned!

Thursday, October 13, 2011

Upcoming features for SQL Azure

Some amazing news has been announced recently at SQL PASS conference.

Key announcements on SQL Azure included the availability of new CTPs for SQL Azure Reporting and SQL Azure Data Sync (now publicly available), as well as a look at the upcoming Q4 2011 Service Release for SQL Azure. 

According the post from Windows Azure Team, the SQL Azure Q4 2011 Service Release will be available by end of 2011 and is aimed at simplifying elastic scale out needs.

Key features include:

  • The maximum database size for individual SQL Azure databases will be expanded 3x from 50 GB to 150 GB.
  • Federation. With SQL Azure Federation, databases can be elastically scaled out using the sharding database pattern based on database size and the application workload.  This new feature will make it dramatically easier to set up sharding, automate the process of adding new shards, and provide significant new functionality for easily managing database shards.
  • New SQL Azure Management Portal capabilities.  The service release will include an enhanced management portal with significant new features including the ability to more easily monitor databases, drill-down into schemas, query plans, spatial data, indexes/keys, and query performance statistics.
  • Expanded support for user-controlled collations.

Read more details here and here (SQL Azure Reporting CTP) or watch the Keynote from the conference.

Clouds are coming to Seattle next month

Technical Content, Technical Experts

The Cloud Experience track at SIC is for experienced developers who want to learn how to leverage the cloud for mobile, social and web app scenarios.  No matter what platform or technology you choose to develop for, these sessions will provide you with a deeper understanding of cloud architecture, back end services and business models so you can scale for user demand and grow your business.

Register today using the promo code “azure 200” and attend SIC for only $150 (a $200 savings).

  • Attend a full day of technical sessions and learn more about leveraging the cloud for mobile, web and social scenarios. View the list of confirmed Cloud Experience speakers.  Sessions include:
    • Great Mobile Apps Make Money – Intro to Cloud Experience Track
    • Mobile + Cloud, Building Mobile Applications with Windows Azure
    • Zero to Hero: Windows Phone, Android, iOS Development in the Cloud
    • Building Web Applications with Windows Azure
    • Building Social Games on Windows Azure
  • Cloud Experience speakers and technical experts will be available to provide technical assistance and resources for developing, deploying and managing mobile, social and web apps in the cloud.

Seattle Interactive Conference (SIC): November 2-3, 2011, The Conference Center at WSCC

Tuesday, October 4, 2011

Slides and Recording from last user group meeting / Identity and Access Control in the Cloud

Hello all. Last weekend we had a great cross-user-group sessions and party at Bansko, Bulgaria. Here we have 8 user group focused on various Microsoft Technologies. I, particularly, am engaged with the Windows Azure User Group Bulgaria and was talking on Identity and Access Control in the Cloud. It was very good talk and very good audience. The slides can be viewed/downloaded here. While I had the good intend to stream live over Live Meeting, there were some technical problem outside of what could be solved, but I made a recording using Camtasia Studio from TechSmith. You can download full-sized video from here, and I also made a lower quality video.

Looking forward for our next meeting, which will be held soon and the topic will be interested to most Web and Silverlight developers considering moving to the cloud.

Monday, October 3, 2011

Windows Azure SDK 1.5 Update released!

It appeared that there is a bug in the Windows Azure SDK 1.5, which was released in September after Build Conference. The development team has been working hard to provide a fix for this issue. You can read more about the issue here and here, and download the new update from here (just click “Get Tools and SDK”).

Note, that this is just an update, you do not need to uninstall v.1.5 of the SDK to apply this update. But you’ll have to update the reference to Microsoft.WindowsAzure.StorageClient.dll in all your projects that were upgraded to v.1.5.