by Brett Pierce
SharePoint 2010 has the wonderful Silverlight Web Part, which you can use to host a Silverlight application. Yay! So I create my app and deploy it to my Dev environment. Host the Silverlight app in the Site Assets library in SharePoint. Display it in the Silverlight Web Part. The Silverlight application calls a bunch of WCF services hosted on another machine.
Now this all works really well on my Dev environment… no issues. I go to the customer to deploy and… nothing works, because it cannot call the services and apparently I need crossdomain.xml to allow the calls through to the service layer. Awesome! Except, I already have both a crossdomain.xml and clientaccesspolicy.xml in my website hosting the services in IIS.
<?xml version="1.0"?> <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy> <allow-http-request-headers-from domain="*" headers="*"/> </cross-domain-policy>
<access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> uri="*"/> </allow-from> <grant-to> <resource include-subpaths="true" path="/"/> </grant-to> </policy> </cross-domain-access> </access-policy>
Now, this will basically allow all calls through to the services, from any other domain. Here’s the thing though, the SharePoint site has an alternate access mapping such as http://epm.foxit.co.za
Scratched my head, tried to deploy the services to another server. Still nothing. It wasn’t the firewall. It wasn’t any weird NLB routing the traffic to another server.
I called on the help of a developer based at the client, who instantly said… why don’t we just create a DNS entry for the web services. I kept saying no. It can’t be. I’ve done this a million times before. Each and every time it managed to hit the services, except the SharePoint site was called by the server name and not the alternate access mapping.
I eventually caved in and decided to give it a try and BOOM! It worked first time! Who’d have thought.
Thanks to Renier Opperman from DRA for the DNS entry solution.