Tuesday, April 20, 2010

Silverlight WCF and Azure

Azure is the cloud server base technology. WCF services can produce server pages which can be consumed by Silverlight. However this operation can be tricky.
I participated in an interesting thread Silverlight 3 / November Azure CTP / WCF Sample topic:

Allen Chen came up with an interesting sample for this.
This gives you the fundamentals required to make it work in Visual Studio.
This will come up with 2 web pages. The click me button works. The other 8080 port shows an error. Instead of if you browse to you will see the web service and the will produce the XML output for the service.
Couple of key points which make this work.
Note the clientaccesspolicy.xml file and the web.config files
also the proxy setting in the mainpage.xaml.cs file
proxy = new SilverlightApplication1.ServiceReference1.Service1Client(new BasicHttpBinding(),

new EndpointAddress(string.Format("http://{0}:{1}/Service1.svc", HtmlPage.Document.DocumentUri.Host, "8080")));

You may also run into a bug: "Fixing the Silverlight Design Time in a Windows Azure Cloud Service issue in Visual Studio 2008" showing as an “Object reference not set to an instance of an object" in XAML editor. Jim Nakashima has given a fix in his blog

1 comment:

  1. Bluehost is one of the best hosting provider with plans for all of your hosting requirments.