我想从我的silvelight应用程序中与控制台XML服务器进行连接。有可能吗?
步骤: 1.启动控制台XML RPC服务器
控制台XML服务器的代码如下:
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();
}
}(HttpWebResponse)state.Request.EndGetResponse(result);ResponseResponse(IAsyncResult result) { XmlRpcHelperRequestState state = result.AsyncState as XmlRpcHelperRequestState;尝试{ state.Response =IAsyncResult.} catch (异常e) { //最终带SecurityException }到这里{. }
我使用的是VS2008专业版,XP专业版,.net 3.5版,Silverlight3。我很乐意提供所需的任何附加信息(或代码)。
发布于 2009-10-16 12:15:18
我怀疑这是一个丢失clientaccesspolicy.xml文件的案例。
由于您的silverlight应用程序将从另一个权威机构启动,它将尝试访问该文件http://localhost:5678/。由于您的小测试不支持该文件Silverlight阻止跨“域”活动。
https://stackoverflow.com/questions/1577068
复制相似问题