1.用TCP通道:
Server.cs
...
TchChannel tcpchan=new TcpChannel(8800);
ChannelServices.RegisterChannel(tcpchan);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemotObject),"RemotObject",WellKnownObjectMode.Singleton);
...
Client.cs
...
TcpClientChannel Tcpchan = new TcpClientChannel();
ChannelServices.RegisterChannel(tcpchan);
Remotingurl="tcp://localhost:8800/RemotObject";
object ob = Activator.GetObject(typeof(RemotObject),Remotingurl);
...
以上能够正确执行。2.用Http通道
Server.cs
...
HttpChannel httpchan=new HttpChannel(8800);
ChannelServices.RegisterChannel(httpchan);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemotObject),"RemotObject",WellKnownObjectMode.Singleton);
...
Client.cs
...
HttpClientChannel httpchan = new httpClientChannel();
ChannelServices.RegisterChannel(httpchan);
Remotingurl="http://localhost:8800/RemotObject";
object ob = Activator.GetObject(typeof(RemotObject),Remotingurl);
...执行结果为什么提示:“指定的SOAPAction无效”
Server.cs
...
TchChannel tcpchan=new TcpChannel(8800);
ChannelServices.RegisterChannel(tcpchan);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemotObject),"RemotObject",WellKnownObjectMode.Singleton);
...
Client.cs
...
TcpClientChannel Tcpchan = new TcpClientChannel();
ChannelServices.RegisterChannel(tcpchan);
Remotingurl="tcp://localhost:8800/RemotObject";
object ob = Activator.GetObject(typeof(RemotObject),Remotingurl);
...
以上能够正确执行。2.用Http通道
Server.cs
...
HttpChannel httpchan=new HttpChannel(8800);
ChannelServices.RegisterChannel(httpchan);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemotObject),"RemotObject",WellKnownObjectMode.Singleton);
...
Client.cs
...
HttpClientChannel httpchan = new httpClientChannel();
ChannelServices.RegisterChannel(httpchan);
Remotingurl="http://localhost:8800/RemotObject";
object ob = Activator.GetObject(typeof(RemotObject),Remotingurl);
...执行结果为什么提示:“指定的SOAPAction无效”
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货