问题:
一个非常简单的.Net Remoting入门程序 可能是配置文件有问题
当运行服务器端程序 好像没有完成对象及通道的创建
当运行客户端程序 也出错 (都是控制台程序) 代码如下:
1 远程对象类 MyRemoteObject.cs (我将这些程序都放在SimpleServer目录下,而且已经生成MyRemoteObject.dll, SimpleClient.exe以及SimpleServer.exe文件了)
using System;
namespace Wrox.Samples
{
public class MyRemoteObject:System.MarshalByRefObject
{
public MyRemoteObject()
{
Console.WriteLine("Constructor called");
}
public string Hello()
{
Console.WriteLine("Hello called");
return "Hello,.NET Client!";
}
}
}
2服务器端程序 SimpleServer.cs
using System;
using System.Runtime.Remoting;
namespace Wrox.Samples
{
class SimpleServer
{
static void Main(string [] args)
{
RemotingConfiguration.Configure("SimpleServer.exe.config");
Console.WriteLine("Press return to exit!");
Console.ReadLine();
}
}
}
3 服务器端配置 SimpleServer.exe.config
<configuration>
  <system.runtime.remoting>
    <application name="SimpleServer">
    <service>
     <wellknown
       mode="SingleCall"
       type="Wrox.Samples.MyRemoteObject,MyRemoteObject"
       objectUri="MyRemoteObject"/>
    </service>
    <channels>
      <channel ref="tcp server" port="9000"/>
    </channels>
    </application>
       
  </system.runtime.remoting>
</configuration>4客户端程序 SimpleClient.cs
using System;
using System.Runtime.Remoting;
namespace Wrox.Samples
{
class SimpleClient
{
static void Main(string [] args)
{
RemotingConfiguration.Configure("SimpleClient.exe.config");
MyRemoteObject obj=new MyRemoteObject();
Console.WriteLine(obj.Hello());
}
}
}5客户端配置 SimpleClient.exe.config
<configuration>
 <system.runtime.remoting>
  <application name="SimpleClient">
   <client url="tcp://localhost:9000/SimpleServer">
    <wellknown
       type="Wrox.Samples.MyRemoteObject,MyRemoteObject"
       url="tcp://localhost:9000/SimpleServer/MyRemoteObject"/>
   </client>
   <channels>
     <channel ref="tcp client"/>
   </channels>
  </application>
  </system.runtime.remoting>
</configuration> 哪位好心人帮俺看看啊!!!