Silverlight Communication with the XML RPC Console Server

I want to communicate with the console XML RPC server from my powerful application. Is it possible?

Steps: 1. Launch the XML RPC Console Server

Code for XML console RPC server:

using System; using System.Collections; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; using CookComputing.XmlRpc; public class StateNameServer : MarshalByRefObject, IStateName { public string GetStateName(int stateNumber) { return "whatever"; } } class _ { static void Main(string[] args) { IDictionary props = new Hashtable(); props["name"] = "MyHttpChannel"; props["port"] = 5678; HttpChannel channel = new HttpChannel(props,null,new XmlRpcServerFormatterSinkProvider()); ChannelServices.RegisterChannel(channel,false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(StateNameServer),"statename.rem",WellKnownObjectMode.Singleton); Console.WriteLine("Press <ENTER> to shutdown"); Console.ReadLine(); } } 
  1. Launching the Silverlight Application I used the code from http://code.google.com/p/xmlrpc-silverlight/ I created a new Silverlight application to which I linked the code from this link. When I launch the website (in localhost with port 1139) that runs my SL application, a SecurityException occurs.

     void ResponseResponse(IAsyncResult result) { XmlRpcHelperRequestState state = result.AsyncState as XmlRpcHelperRequestState; try { state.Response = (HttpWebResponse)state.Request.EndGetResponse(result); ... } catch (Exception e) { // comes here with SecurityException } finally { ... } } 

I am using VS2008 Professional, XP Professional, .net 3.5, Silverlight3. I will be happy to provide you with any additional information (or code).

+4
source share
1 answer

I suspect this is a case of a missing clientaccesspolicy.xml file.

Since your silverlight application will be launched from another source, it will try to access this file http://localhost:5678/ . Since your little test does not support this file, Silverlight blocks this cross-domain. Activity.

+1
source

All Articles