首页 新闻 会员 周边 捐助

跪求.NET Remoting 客户端激活模式示例

0
悬赏园豆:10 [已关闭问题] 关闭于 2012-09-06 15:40
//服务器端
     HttpServerChannel channel = new HttpServerChannel(9090);
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.ApplicationName = "http://localhost:9090/ServiceMessage";
            RemotingConfiguration.RegisterActivatedServiceType(typeof(RemotableType.RemotableType)
                );
            Console.WriteLine("Listening for requests. Press enter to exit...");
            Console.ReadLine();
//客户端
HttpClientChannel channel = new HttpClientChannel();
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.ApplicationName = "Http://localhost:9090/ServiceMessage";
            RemotingConfiguration.RegisterActivatedClientType(typeof(RemotableType.RemotableType), "Http://localhost:9090/ServiceMessage");

            //RemotableType.RemotableType type = (RemotableType.RemotableType)Activator.GetObject(typeof(RemotableType.RemotableType)
            //    , "http://localhost:9090/ServiceMessage");
            RemotableType.RemotableType type = new RemotableType.RemotableType();
            RemotableType.Person p = new RemotableType.Person { Name = "Jone" };
            Console.WriteLine(type.SayHello(p));
            Console.ReadKey();

总是报错 Requested Service not found

请问怎么修改啊

朝曦的主页 朝曦 | 小虾三级 | 园豆:1073
提问于:2012-09-02 18:13
< >
分享
所有回答(2)
0

不知道有没有帮助,今天看到的博文, .NETRemoting(一)

http://www.cnblogs.com/chenyuming507950417/archive/2011/12/19/2293644.html

土豆屋 | 园豆:354 (菜鸟二级) | 2012-09-03 01:33

他只介绍了,服务器激活方式,我需要的是客户端激活方式。依然谢谢你

支持(0) 反对(0) 朝曦 | 园豆:1073 (小虾三级) | 2012-09-03 14:24
0

不知道现在回答算不算晚,服务器端的这句代码 

RemotingConfiguration.ApplicationName = "http://localhost:9090/ServiceMessage";

改成

 RemotingConfiguration.ApplicationName = "ServiceMessage";
应该没问题了

junhc | 园豆:202 (菜鸟二级) | 2012-10-17 16:59

客户端的这句代码不需要  

  RemotingConfiguration.ApplicationName = "Http://localhost:9090/ServiceMessage";

支持(0) 反对(0) junhc | 园豆:202 (菜鸟二级) | 2012-10-17 17:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册