//服务器端 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
请问怎么修改啊
不知道有没有帮助,今天看到的博文, .NETRemoting(一)
http://www.cnblogs.com/chenyuming507950417/archive/2011/12/19/2293644.html
他只介绍了,服务器激活方式,我需要的是客户端激活方式。依然谢谢你
不知道现在回答算不算晚,服务器端的这句代码
RemotingConfiguration.ApplicationName = "http://localhost:9090/ServiceMessage";
改成
RemotingConfiguration.ApplicationName = "ServiceMessage";
应该没问题了
客户端的这句代码不需要
RemotingConfiguration.ApplicationName = "Http://localhost:9090/ServiceMessage";