我的Remoting程序没有问题,用继承自System.MarshalByRefObject的普通类可以正常使用
我看到 Windows.Forms.Form是继承自System.MarshalByRefObject所以写了一个窗口类ShareForm在服务器端:
HttpChannel hc=new HttpChannel(12345);
ChannelServices.RegisterChannel(hc);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(ObjectLibrary.ShareForm),"MyShareForm.soap",WellKnownObjectMode.Singleton);
在<客户端>如下,点button1的时候,服务器端弹出了SharForm,但弹出后显示不正常,也没有反应了,为什么呢?
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
HttpChannel hc=new HttpChannel();
ChannelServices.RegisterChannel(hc);
object oo=Activator.GetObject(typeof(ObjectLibrary.ShareForm),"http://localhost:12345/MyShareForm.soap");
this.shareForm=(ObjectLibrary.ShareForm)oo;
}
private void button1_Click(object sender, System.EventArgs e)
{
if(!this.shareForm.Visible)
{
this.shareForm.Show();
}
this.shareForm.AddText(this.richTextBox1.Text);
}
谢谢!!..
我看到 Windows.Forms.Form是继承自System.MarshalByRefObject所以写了一个窗口类ShareForm在服务器端:
HttpChannel hc=new HttpChannel(12345);
ChannelServices.RegisterChannel(hc);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(ObjectLibrary.ShareForm),"MyShareForm.soap",WellKnownObjectMode.Singleton);
在<客户端>如下,点button1的时候,服务器端弹出了SharForm,但弹出后显示不正常,也没有反应了,为什么呢?
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
HttpChannel hc=new HttpChannel();
ChannelServices.RegisterChannel(hc);
object oo=Activator.GetObject(typeof(ObjectLibrary.ShareForm),"http://localhost:12345/MyShareForm.soap");
this.shareForm=(ObjectLibrary.ShareForm)oo;
}
private void button1_Click(object sender, System.EventArgs e)
{
if(!this.shareForm.Visible)
{
this.shareForm.Show();
}
this.shareForm.AddText(this.richTextBox1.Text);
}
谢谢!!..
WindowsForms 的Control都是从System.MarshalByRefObject继承来的,但都有界面呀..
http://blog.csdn.net/chengking/archive/2005/10/26/517349.aspx
但没有form远程对象的
我的问题是为什么在客户端Show()一个远程Form对象时,服务器端会象死机一样...