求Remoting怎么使用?最好给代码Thanks 求Remoting怎么使用?最好给代码Thanks 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 所使用dll代码:public class gxyremoting:System.MarshalByRefObject,gxyremotinginterface.remotinginterface { public gxyremoting() { Console.WriteLine("\n启动一个实例"); } public DataSet GridData(string DataBaseName,string TableName) { Console.WriteLine("\n连接到数据库"+DataBaseName+"的表"+TableName); string connetstring="workstation id=GAOXIAOYONG;packet size=4096;user id=sa;data source=GAOXIAOYONG;persist security info=False;initial catalog="+DataBaseName; System.Data.SqlClient.SqlConnection conn=new SqlConnection(connetstring); string strsql="select * from " +TableName; DataSet ds=new DataSet(); System.Data.SqlClient.SqlDataAdapter adap=new SqlDataAdapter(strsql,conn); adap.Fill(ds); return ds; } } 客户端代码:ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel()); ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Http.HttpClientChannel()); rf= (remotinginterface)Activator.GetObject(typeof(remotinginterface),"HTTP://192.168.0.123:9001/gxyremoting"); if( rf==null) { rf= (remotinginterface)Activator.GetObject(typeof(remotinginterface),"TCP://192.168.0.123:9000/gxyremoting"); } 服务器端代码:TcpServerChannel tcpc=new TcpServerChannel(9000); System.Runtime.Remoting.Channels.Http.HttpServerChannel httpc=new System.Runtime.Remoting.Channels.Http.HttpServerChannel(9001); RemotingConfiguration.RegisterWellKnownServiceType(typeof(gxyremoting),"gxyremoting",WellKnownObjectMode.SingleCall); ChannelServices.RegisterChannel(tcpc); ChannelServices.RegisterChannel(httpc); Console.Write("启动服务器"); Console.ReadLine(); 关于C#读取excel的问题,求助。 急,求个算法~ 菜鸟问题,treeview取消选择所有节点. baidu的一个搜索小缺陷?(我咱就提不出问题?) Equals 和ReferenceEquals有何区别 有个小想法。我想了半天没得到答案。 ASPX页面中如何实现可填写的表格TABLE? 请教如何在datagrid中实现“层”操作 哪个软件培训机构靠谱呢,包就业那种。 vs能跟踪到函数的返回值吗? datagrid如何添加事件? 怎样才能获得窗口中有焦点控件的句柄
public class gxyremoting:System.MarshalByRefObject,gxyremotinginterface.remotinginterface
{
public gxyremoting()
{
Console.WriteLine("\n启动一个实例");
}
public DataSet GridData(string DataBaseName,string TableName)
{
Console.WriteLine("\n连接到数据库"+DataBaseName+"的表"+TableName);
string connetstring="workstation id=GAOXIAOYONG;packet size=4096;user id=sa;data source=GAOXIAOYONG;persist security info=False;initial catalog="+DataBaseName;
System.Data.SqlClient.SqlConnection conn=new SqlConnection(connetstring);
string strsql="select * from " +TableName;
DataSet ds=new DataSet();
System.Data.SqlClient.SqlDataAdapter adap=new SqlDataAdapter(strsql,conn);
adap.Fill(ds);
return ds;
}
}
ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Tcp.TcpClientChannel());
ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Http.HttpClientChannel());
rf= (remotinginterface)Activator.GetObject(typeof(remotinginterface),"HTTP://192.168.0.123:9001/gxyremoting");
if( rf==null)
{
rf= (remotinginterface)Activator.GetObject(typeof(remotinginterface),"TCP://192.168.0.123:9000/gxyremoting");
}
TcpServerChannel tcpc=new TcpServerChannel(9000);
System.Runtime.Remoting.Channels.Http.HttpServerChannel httpc=new System.Runtime.Remoting.Channels.Http.HttpServerChannel(9001);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(gxyremoting),"gxyremoting",WellKnownObjectMode.SingleCall);
ChannelServices.RegisterChannel(tcpc);
ChannelServices.RegisterChannel(httpc);
Console.Write("启动服务器");
Console.ReadLine();