未处理的“System.Runtime.Serialization.SerializationException”类型的异常出现在 mscorlib.dll 中。
其他信息: 由于安全限制,无法访问类型 System.Runtime.Remoting.ObjRef。
=============remote 组件代码
using System;
using System.Runtime.Remoting.Lifetime;
namespace Wrox.Samples
{
public class MyRemoteObject : System.MarshalByRefObject
{
private int state;
public MyRemoteObject(int state)
{
Console.WriteLine("Constructor called");
this.state = state;
}
public int State
{
get
{
return state;
}
set
{
state = value;
}
}
public override object InitializeLifetimeService()
{
ILease lease = (ILease)base.InitializeLifetimeService();
if (lease.CurrentState == LeaseState.Initial)
{
lease.InitialLeaseTime = TimeSpan.FromMinutes(1);
lease.RenewOnCallTime = TimeSpan.FromSeconds(20);
}
return lease;
}
public string Hello()
{
Console.WriteLine("Hello called");
return "Hello, .NET Client!";
}
}
}
呵呵,原问题高手已解决,至于配置问题,可以搜索一下MSDN 里面有示例