tags:

views:

249

answers:

2

Hello,

I'm learning to build Silverlight 3 apps using WCF to communicate with the back end. We are going to deploy to IIS7 on Server2008 or Vista. The client binaries as well as the web service binaries are all located in the same IIS web directory. When I hit the service front page (http://localhost/MyService.svc) it returns just fine. When I hit the app (http://localhost/index.html) i get my Silverlight app. The static material renders just fine, however the two fields im trying to fill return with CrossDomainError. From what I understand this occurs when you hit a service from a page hosted on some other domain. I don't believe I'm doing that, unless unwittingly.

The Exception Message is :

[CrossDomainError] Arguments:http://localhost:2721/Service1.svc Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See [some horrendous url which i wont reproduce here since it was useless anyway]

I opened port 2721 both inbound and outbound with no effect.

Any thoughts?

Thanks, Brian

+2  A: 

For two documents to be considered to have the same origin everything must be exactly the same: protocol (http/https), domain and port.

So, if you open up http://localhost and try to make a request to http://localhost:2721, you'll get that error.

seth
thanks! follow up question here: http://stackoverflow.com/questions/1325118/how-do-you-create-obtain-a-cross-domain-policy-for-an-iis7-wcf-service
sweeney
+1  A: 

You need to have a crossdomain.xml and/or a clientaccesspolicy.xml at the root of your website (crossdoomain.xml is required for for flash compatability, both work with silverlight). This xml needs to cotain the following:

<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true" />
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
Jaimal Chohan
ok so i've done this but i still get the cross domain error. is there some thing else i should consider?
sweeney