views:

399

answers:

1

I understand that for Silverlight to be able to make a cross-domain request using the WebClient class, there needs to be a clientaccesspolicy.xml at the root of the server. I got this working, and when the Silverlight app has been compiled in debug mode, this works great. When the Silverlight app is compiled in release mode, however, I get a SecurityException. Even weirder, it seems as if the silverlight app is not even making the request to the (other domain) server -- it's just throwing the exception without even checking!

Any help would be appreciated...

P.S.: It's HTTP (but on port 30588) and the request is for an extension-less path (the web service returns JSON).

+2  A: 

LOL, I solved it... in release mode (but not in Debug), the client was starting up faster than the server (they were both set as "Start Up Projects" in VS). Consequently, the client (Silverlight) was requesting clientaccesspolicy.xml before the server had started and since the server wasn't running yet, couldn't find the host. This manifested itself as said SecurityException. I added a Thread.Sleep in the client to "fix" it (said hack won't be going into any source control/actual builds, obviously).

So the lesson to be learned... uh... the SecurityException in Silverlight needs to be more detailed as to its cause...?

Robert Fraser