This sample creates a simple WCF calculator service and builds a Silverlight client for it. The client is then hosted alonside the service in the Azure fabric. Here is a quick walkthrough of the steps taken to build this solution:
- Create new Web Cloud Service project called Calculator
- In the Calculator_WebRole website, add a new WCF Service called Service.svc. The service contains two endpoints defined in the Web.config file.
- an endpoint using a cusom binary binding over HTTP - can be used by both .Net and Silverlight clients
- a metadata endpoint that both .Net and Silverlight clients can use to generate references to the service
- Create a Silverlight client by adding a new Silverlight Application project called SilverlightCalculator. When adding the project you will be asked where to host the Silverlight control, and you should accept the default value of hosting it inside of the Calculator_WebRole website. We want the Silverlight control to be hosted alongside the WCF service in the Azure cloud fabric, and this is the exact configuration being suggested.
- Add a Service Reference to the WCF Service in the SilverlightCalculator project and use it to call operations
Demo Client | Demo Service Here is the final result showing the Silverlight client accessing the service:
|