让client调用Monthlist的内容显示在ListBox中。
运行时点client的接收按键后报异常请高手指教!
namespace MonthListClient
{
public partial class FormMonthListClient : Form
{
public FormMonthListClient()
{
InitializeComponent();
HttpChannel c = new HttpChannel();
ChannelServices.RegisterChannel(c);
} private void receive_Click(object sender, EventArgs e)
{
MonthServer.MonthList monthlist = (MonthServer.MonthList)Activator.GetObject(typeof(MonthServer.MonthList), "http://localhost:8081/Monthlist");
this.Monthlist.DataSource = monthlist.getCountryList();
} private void FormMonthListClient_Load(object sender, EventArgs e)
{ }
}
}
namespace MonthListHost
{
class MonthListHost
{
static void Main(string[] args)
{
HttpChannel myChannel = new HttpChannel(8080);
ChannelServices.RegisterChannel(myChannel); RemotingConfiguration.RegisterWellKnownClientType(typeof(MonthServer.MonthList), "MonthList"); System.Console.WriteLine("press enter to exit");
System.Console.ReadLine();
}
}
}namespace MonthAccess
{
public class MonthList : MarshalByRefObject
{
private string[] month ={ "1", "2", "3", "4", "5", "6" };
public MonthList()
{
}
public String[] getCountryList()
{
return month;
}
}
}
运行时点client的接收按键后报异常请高手指教!
namespace MonthListClient
{
public partial class FormMonthListClient : Form
{
public FormMonthListClient()
{
InitializeComponent();
HttpChannel c = new HttpChannel();
ChannelServices.RegisterChannel(c);
} private void receive_Click(object sender, EventArgs e)
{
MonthServer.MonthList monthlist = (MonthServer.MonthList)Activator.GetObject(typeof(MonthServer.MonthList), "http://localhost:8081/Monthlist");
this.Monthlist.DataSource = monthlist.getCountryList();
} private void FormMonthListClient_Load(object sender, EventArgs e)
{ }
}
}
namespace MonthListHost
{
class MonthListHost
{
static void Main(string[] args)
{
HttpChannel myChannel = new HttpChannel(8080);
ChannelServices.RegisterChannel(myChannel); RemotingConfiguration.RegisterWellKnownClientType(typeof(MonthServer.MonthList), "MonthList"); System.Console.WriteLine("press enter to exit");
System.Console.ReadLine();
}
}
}namespace MonthAccess
{
public class MonthList : MarshalByRefObject
{
private string[] month ={ "1", "2", "3", "4", "5", "6" };
public MonthList()
{
}
public String[] getCountryList()
{
return month;
}
}
}
解决方案 »
- 编译错误 !!
- 数据绑定问题,WINFORM
- C# WinForm编程会不会成为趋势?是否会超越C++,delphi,VB等目前还比较主流的编程言语。
- 新手 请问如何可视化的添加对象的已包含的事件?好象不能像VB一样
- c#中接口可以包含字段吗?
- 超级简单!
- 接口 事件 的实现问题
- 如何在.net中的winfom程序中实现有固定格式的表格报表
- 哪位能通俗的描述一下堆和栈的概念和用处?
- 电脑有多张网卡,用TCPIP客户端连接指定IP地址和端口号会连接失败,禁用掉多余的网卡,再次连接就能成功
- 我的Visual Studio 2005开发速度越来越慢
- C# 如何使用GetPixel函数,在Panel上面获取背景色
谢谢各位指教!