未处理 System.Runtime.Remoting.RemotingException?

nyzhl 2008-03-26 07:12:34
未处理 System.Runtime.Remoting.RemotingException
Message="无法加载类型“zhl.Person, Person, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”。"
下面是Person类:
namespace zhl
{
public class Person:MarshalByRefObject
{
private string m_name;

public string Name
{
get
{
return this.m_name;
}
set
{
this.m_name = value;
}
}
public string SayHello()
{
Console.WriteLine("Hello,my name is {0}",m_name);
return "Hi," + m_name;
}
}
}
然后是客户端调用:
<?xml version='1.0' encoding='utf-8'?>
<configuration>
<system.runtime.remoting>
<application>
<client url='http://localhost:8000'>
<activated type='zhl.Person,Person' />
</client>
<channels>
<channel port='0' ref='Http' />
</channels>
</application>
</system.runtime.remoting>
</configuration>

using System;
using System.Runtime.Remoting;

namespace zhl
{
class ActiveClient
{
static void Main(string[] args)
{
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);

Person p = new Person();
p.Name = "zhao hongliang";
p.SayHello();
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
}
}
}

服务器端调用:
<?xml version='1.0' encoding='utf-8'?>
<configuration>
<system.runtime.remoting>
<application>
<service>
<activated type ='zhl.Person,Person' />
</service>
<channels>
<channel port='8000' ref='Http' />
</channels>
</application>
</system.runtime.remoting>
</configuration>

using System;
using System.Runtime.Remoting;

namespace zhl
{
class ActiveServer
{
static void Main(string[] args)
{
RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
Console.WriteLine("Press enter to exit");
Console.ReadLine();
}
}
}
快疯掉了 找不到错误~!
...全文
177 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
mogui_ 2008-03-27
  • 打赏
  • 举报
回复
我帮你的代码测试过了,没问题呀!

110,556

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧