background image
  logo  
Icon

Hosting Silverlight Accessible WCF Services in an Azure WebRole

Thu Jan 14th 2010 by Brett
I recently spent some time writing a web application for Windows Azure. I am really excited about Azure and plan to leverage it for my development projects whenever applicable. This blog is actually hosted on Azure as it gave me a good opportunity to get some hands on experience with the technology. The blog post editor is actually a Silverlight application that posts its changes through a WCF webservice.

I created a Silverlight compatible WCF service and was able to add a service reference in VS2010. I should note that I had the website project set as my Startup project, not the Azure Roles project which spins up the Azure Fabric Simulators. After publishing to Azure and attempting to use the webservice from Silverlight I received the following message:

“The message with To ‘http://thesilvermethod.cloudapp.net/BlogService.svc’ cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver’s EndpointAddresses agree.”

As it turns out WCF performs message filtering so that messages sent to different logical adresses can be mapped to the same physical address. In an Azure solution where unknown layers of redirection (Load Balancers, Firewall Redirection) are present between the client and the server the situation exists where the physical and logical are not one and the same. After some research I determined that you could force all requests coming to a given physical address to be accepted by the service.

I had to decorate my class with the followig attribute :
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

More information about Service Addressing can be found here if you are curious.
http://msdn.microsoft.com/en-us/magazine/cc163412.aspx

Hopefully this will save someone some time.

0 Comments     follow

Login to post comments
 

Recent Posts

By Month