关于remoting的问题 使用RemotingConfiguration.Configure(string)后创建的不是远程对象??

来源:百度知道 编辑:UC知道 时间:2024/06/14 07:06:48
namespace CustomerClient//客户端
{
class CustomerMain
{
static void Main(string[] args)
{
RemotingConfiguration.Configure("..\\..\\CustomerClient.exe.config",false);
CustomerService custSvc = new CustomerService();//------->在这里创建的不是远程对象,这个为什么???
Console.WriteLine(custSvc.Test());
Customer cust = custSvc.CreateCustomer("Homer");
Console.WriteLine(cust.SayHello());
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="CustomerLibrary.CustomerService,CustomerLibrary"
url="http://localhost:13101/customer.soap&quo

CustomerService custSvc= (CustomerService custSvc)Activator.GetObject(typeof(CustomerService custSvc)
, System.Configuration.ConfigurationSettings.AppSettings["ServiceURL"]);
client
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="ServiceURL" value="tcp://localhost:13101/customer.soap"/>
</appSettings>
</configuration>