简体   繁体   中英

Silverlight Cross Domain exception when using IP Address

I have a strange issue where browsing to my Silverlight 5 website using the host name works perfectly fine but when using the IP address instead it throws this exception: http://iforce.co.nz/i/1ohkll5v.32o.png

I have implemented the clientaccesspolicy return stream in a REST service on my self hosted WCF web service (similar to Cross Domain Exception with WcfSvcHost ), and it works perfectly fine when using the hostname. However if I debug that method it never actually gets called in the scenario with the IP address.

Is there some limitation in Silverlight that does not allow you to use the IP address with WCF? I seem to remember that this was working before some time ago.

Although this is an old question—and it will not help you, it might help others.

I had the same issue and lost hours trying to find the answer. The problem for me—in the end—was that I was referencing the WCF service using the machine name. Because of this—Silverlight thought I was referring to a local machine—so Silverlight doesn't even bother making a client policy request.

So just reference the service using an IP address instead of the machine name. Even if that IP address is local. Then check with Fiddler and notice that the Silverlight client will now make a policy request before the first service call.

Another reason of this error is that Silverlight prevents cross-zone acccess, too. Therefore, in the clinet browser, you need to add both addresses (the one with hostname and the one with IP address) to the same Security Zone (either Local Intranet or Trusted Sites) in Internet Explorer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM