|What is Windows Azure? Windows Azure provides developers computation power storage and can scale web applications on internet through Microsoft Datacenters. Developers can use Azure platform to build WCF service application using their existing Visual Studio 2010 expertise.|
Windows Azure supports the protocols and formats including SOAP, REST and XML. This post discuss about creating a simple WCF Service and hosting it on Windows Azure and consuming in client application.
1. Create a WCF Service Contract in Windows Class Library project as shown below which in-turn you use in Web role, worker role and in client application. Read more about roles in windows Azure here
2. Create a Windows Azure Project as shown below
Do not add any service role at the moment, just say ok.
3. Add a new role project to the solution and select the WCF Service Web role project type in dialogue box as shown below
4. Add a project reference to WCF Contract project
5. Write the following code in Service.svc.cs file in WCFServiceWebRole project
6. Change the web.config file service model section as shown below
7. Add a worker role to AzureWCFService project as shown in below
8. Define the end points for worker role in the settings as shown below
Important point is Web role in Azure project calls the WCF Service in the worker role via an internal point which we defined above.
9. Right click the AzureWCFService project and say publish to host on WindowsAzure environment. You will get the following window when you say publish
Enter your credentials to publish the service to WindowsAzure. It actually prepare the configure files for deployment.
10. Consume the WCF service in client project as shown below
|Share this post :|