Saturday, October 9, 2010

Silverlight and WCF CommunicationException (Cross Domain Issue)

Recently I got the following error while trying to execute Silverlight project:
“An error occurred while trying to make a request to URI '…'. This could be due to
attempting to access a service in a cross-domain way without a proper cross-domain
policy in place, or a policy that is unsuitable for SOAP services. You may need to
contact the owner of the service to publish a cross-domain policy file and to ensure
it allows SOAP-related HTTP headers to be sent. This error may also be caused by
using internal types in the web service proxy without using the
InternalsVisibleToAttribute attribute. Please see the inner exception for more
details.”
After hours of troubleshooting finally I managed to solved problem. It was a silly mistake of launching the Silverlight project directly (as the default start up project when hitting F5) instead of the web project that references the Silverlight project.

I hope this post will save others some time :)