1
votes

as the title already states I am trying to call a self hosted WCF service (hosted in a windows service) from a silverlight 4.0 application which is hosted in sharepoint 2010. I use the basicHttpBinding and I already tried a lot of things as suggested here:

http://www.dotnetfunda.com/articles/article416.aspx

or here

http://blogs.msdn.com/b/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx

but none of them worked I still get the error:

An error occurred while trying to make a request to URI 'serviceuri'. 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.

The inner exception states:

when deploying an Office solution, check to make sure you have fullfilled all security requirements.

The two files clientaccesspolicy.xml and crossdomain.xml are accessible on http://myserver/clientaccesspolicy.xml and http://myserver/crossdomain.xml

Does anybody have an idea on how to solve this?

1
No, the two machines are on our local LAN.Manfred Ramoser

1 Answers

1
votes

All these things helped me out. But the biggest thing for me was turning on Fiddler and tracing the request/responses from Sharepoint + Silverlight. I was getting a 502 error back for some reason. I noticed that my Url in my code was "http://localhost:", however the request from silverlight was "http://[servername]:" you would think that this should work, however it didn't.

I remembered I had run into issues before where "localhost" was giving me problems, thus what I did was to edit my Host file from /windows/system32/drivers/etc and simply add the line:: 127.0.0.1 [servername]

I did a iisreset, I left fiddler running and I unchecked the Enable IPv6 option (Tools->Fiddler Options) and everything started working. The Clientaccesspolicy.xml could be accessed, and sharepoint + silverlight could call out into the wcf world :)!!!

There was one major issues however, when you turn Fiddler off, it stopped working... Now I have to figure this one out...

I hope this hellps you.