web service上remoting问题
在已经在使用的web service建立一个remote object,主要是另外子系统需要和当前子系统做同步工作.
Web service作为服务器端,在Application_Start()里激活remote object.
BinaryClientFormatterSinkProvider Prc = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider Prv = new BinaryServerFormatterSinkProvider();
Prv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
Hashtable prop = new Hashtable();
prop["port"] = 8085;
IChannelReceiver Ch = new TcpChannel(prop, Prc, Prv);
ChannelServices.RegisterChannel(Ch);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemotingCore.RemoteServer),"WebService.SyncCache", WellKnownObjectMode.SingleCall);
在客户端:
public void SyncCache()
{
RemoteServer syncCache = (RemotingCore.RemoteServer)Activator.GetObject(typeof(RemotingCore.RemoteServer), "tcp://localhost:8085/WebService.SyncCache"); //返回不为null
string ret = syncCache.SayHello(); //出错
}
出错信息: System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it.
BTW: SayHello只是简单返回一个string的过程.
Web service作为服务器端,在Application_Start()里激活remote object.
BinaryClientFormatterSinkProvider Prc = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider Prv = new BinaryServerFormatterSinkProvider();
Prv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
Hashtable prop = new Hashtable();
prop["port"] = 8085;
IChannelReceiver Ch = new TcpChannel(prop, Prc, Prv);
ChannelServices.RegisterChannel(Ch);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemotingCore.RemoteServer),"WebService.SyncCache", WellKnownObjectMode.SingleCall);
在客户端:
public void SyncCache()
{
RemoteServer syncCache = (RemotingCore.RemoteServer)Activator.GetObject(typeof(RemotingCore.RemoteServer), "tcp://localhost:8085/WebService.SyncCache"); //返回不为null
string ret = syncCache.SayHello(); //出错
}
出错信息: System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it.
BTW: SayHello只是简单返回一个string的过程.
...全文
相关推荐
remoting服务自动转变为webservice服务
未完成程序. remoting服务自动转换为webservice服务 thanks
WEB服务、Remoting实例、WCF实例
WEB服务、Remoting实例、WCF实例培训资料 软全的说明,而且里面大部分代码均有详细注释 对于例子均有多种调用方法,比较简单清晰易懂
SOAP和Web_Service的概念
详细介绍了soap和web_service的概念,对于分布式开发具有入门的作用,很高兴与大家分享
基于.NET Remoting框架的分布式系统构建.pdf
#资源达人分享计划#
.NET面试宝典130道经典面试真题及答案
ASP.NET常见面试题及答案


Web Services
