title: Silverlight communication with XML RPC console server
body: <p>I want to comunicate with Console XML RPC server from my silvelight application. Is it possibile?</p>
  
  <p>Steps:
  1. Start the Console XML RPC server</p>
  
  <p>Code for Console XML RPC server is this:</p>
  
  <pre><code>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 &lt;ENTER&gt; to shutdown");
      Console.ReadLine();
    }
  }
  </code></pre>
  
  <ol start="2">
  <li><p>Run Silverlight application
  I used the code from <a href="http://code.google.com/p/xmlrpc-silverlight/" rel="nofollow noreferrer">http://code.google.com/p/xmlrpc-silverlight/</a>
  I created new Silverlight application to which I have attached the code from that link. When I start web site (in localhost with port 1139) which executes my SL app happens SecurityException.</p>
  
  <pre><code>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
      {
          ...
      }
  }
  </code></pre></li>
  </ol>
  
  <p>I am using VS2008 Professional,XP Professional, .net 3.5, Silverlight3. I will gladly provide any additional information (or code) which is needed.</p>