web service上remoting问题

cenlmmx 2007-07-10 01:34:41
在已经在使用的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的过程.
...全文
231 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
aduo_0513 2007-07-10
  • 打赏
  • 举报
回复
为什么要在web服务中用remoting?
yan63 2007-07-10
  • 打赏
  • 举报
回复
应该是需要调用一下webservice的方法才能运行app_start的代码
最好不在webservice里做这个
cenlmmx 2007-07-10
  • 打赏
  • 举报
回复
谢谢楼上建议,还是不行
chenguangxi 2007-07-10
  • 打赏
  • 举报
回复
你改成Http通道试下

IChannelReceiver Ch = new HttpChannel(prop, Prc, Prv);
wdzr_826 2007-07-10
  • 打赏
  • 举报
回复
remoting调试起来很麻烦啊
cenlmmx 2007-07-10
  • 打赏
  • 举报
回复
帮忙解决加追200分!
cenlmmx 2007-07-10
  • 打赏
  • 举报
回复
高手帮帮忙啊
cenlmmx 2007-07-10
  • 打赏
  • 举报
回复
好象是通道没有打开.
我感到疑问的是: 在Application_Start()里激活remote object对吗?

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧