Thursday, December 10, 2009

WPF, Webservices and Cross-Domain Issue

Today I faced an issue in a Silverlight web app.
While accessing a Web-service from Silverlight that was within the same Solution in the VS.

The error i got says like :

‘http://localhost:4522/MyService’. 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. Please see the inner exception for more details.

By placing a Cross-Domain policy file at the root of the web app solved my problem.
I found a suitable solution that describes about the problem in details and a complete solution.

The crossdomain.xml looks like this: