Consuming an Azure-hosted WCF service within a Silverlight application
A standalone Silverlight application will not be able to do much by itself. Most applications will require that they consume data from a data source, such as to get a list of products or customer orders. A common way to send data between .Net applications is through WCF Services.
The following steps will explore how to add a WCF service to your Azure web role, and then consume it from within the Silverlight application:
1. In Visual Studio, right-click on the ASP.Net web role project (WebRole1) and click on Add | New Item.
2. Add a new WCF service named HelloWorldService.svc as shown in the following screenshot:
3. Once the WCF service has been added into the project, three new files will be added to the project:
IHelloWorldService.cs, HelloWorldService.svc
, andHelloWorldService.svc.cs
.4. Open
IHelloWorldService.cs
and change the interface, so that it defines a single method namedGenerateHelloWorldGreeting
that takes no...