Geeks With Blogs
Paul Chapman .Net Musings

So far Parts I & II have not given us anything new – the code will work happily in an ASP.Net or a traditional client application. Now we get to a more interesting bit – creating our Azure Project.

Before we can create an Azure Project you will eventually have to go to the Azure Website – and download the Azure tools from here; http://www.microsoft.com/azure/windowsazurefordevelopers/default.aspx.

Once you have installed these on your development PC you can now create an Azure Project. You will notice that I have not suggested signing up even for a CTP account. The reason is that you can do your development locally – the Azure tools create a kind of mini-Azure on your development PC. This makes little difference now, but when the service is charged for it will make a difference.

To create an Azure Project, look under your chosen language (C# or VB.Net) and select the ‘Cloud Service’ leaf. Then choose the required template. Normally I have picked the ‘Web And Worker Cloud Service’ – this is because I invariably need both a web and worker role. Indeed this project, we will have both. Below

image 

And that is it. We now have an Azure Project, that can be run locally to test it.

The Web service.

Now the Azure project will eventually have a Silverlight frontend and that creates a small problem. Silverlight is designed to be a lightweight download and for this reason it uses a subset of the full .Net runtime. This means that many of the functions that one might take for granted. To allow us the use of the full .Net runtime these are placed behind a WCF web service.

To create a web service you can host it within your Web role. So right-click on the Web role project and select ‘Add’, then ‘New item’

image

 

This will display the above window – select the WCF Service, and give it name then click on the ‘Add’ button.

This creates your Web Service, but we are not finished. Silverlight requires that a Web Service use basic binding. So change the binding of the service double click on the Web.config of the Web Role. Finding the <services> tag. Make sure the ‘binding’ attribute is changed to basicHttpBinding. The following code shows what the section  should look like;

    <service behaviorConfiguration="NewsMashup_WebRole.NewsMashupServiceBehavior"
        name="NewsMashup_WebRole.NewsMashupService">
        <endpoint address="" binding="basicHttpBinding" contract="NewsMashup_WebRole.INewsMashupService">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
</services>

 

So this sets up our Azure project, and our web service.

Posted on Thursday, May 14, 2009 11:18 PM Silverlight , Windows Azure , CodeProject | Back to top


Comments on this post: Windows Azure, TDS, WCF, Silverlight and a few problems on the way Part III – The Azure Project, and creating our Web service.

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © paulschapman | Powered by: GeeksWithBlogs.net