Remoting 配置文件遇到的问题

虽然是个小问题,但是也花了我不少的时间。5555...

在工程中需要调用好几个宿主在windows Service 下的Remoting服务,我起初不知道怎样读取Remoting的配置文件,以至于在调用远程对象时,无法获得服务对象,而只获得的是本地对象。这就是没有读取Remoting配置文件的问题。

所以在Global.asax 文件里

    void Application_Start(object sender, EventArgs e)

    {

         RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);

    }

这样所以得服务就可以用了。

附配置文件:

 
  
<? xml version="1.0" encoding="utf-8" ?>
< configuration >
< system.runtime.remoting >
< application >
< client url ="tcp://172.16.8.108:4500/FileServer" >
< activated type ="WebFiles.MailAttachServer,WebFiles" url ="tcp://172.16.8.108:4500/FileServer/MailAttachServer" />
< activated type ="WebFiles.CFileSvr,WebFiles" url ="tcp://172.16.8.172.16.8.108:4500/FileServer/CFileSvr" />
< activated type ="WebFiles.CFileIndexSvr,WebFiles" url ="tcp://172.16.8.108:4500/FileServer/CFileIndexSvr" />
< activated type ="WebFiles.ArchiveFileIndexSvr,WebFiles" url ="tcp://172.16.8.108:4500/FileServer/ArchiveFileIndexSvr" />
< activated type ="WebFiles.ArchiveFileSvr,WebFiles" url ="tcp://172.16.8.108:4500/FileServer/ArchiveFileSvr" />
< activated type ="WebFiles.TiffSvr,WebFiles" url ="tcp://172.16.8.108:4500/FileServer/TiffSvr" />
</ client >
< channels >
< channel ref ="tcp" />
</ channels >
< client url ="tcp://172.16.8.108:4501" name ="MailRemoting" >
< activated type ="WebMail.CAsyncMailSvr,WebMail" url ="tcp://172.16.8.108:4501" />
</ client >
< client url ="tcp://172.16.8.108:4503/ExportServer" name ="ExportRemoting" >
< activated type ="WebExport.CWebExport,WebExport" url ="tcp://172.16.8.108:4503/ExportServer/CWebExport" />
</ client >
< client url ="tcp://172.16.8.108:4650/IPCService" name ="RuntimeServer" >
< wellknown type ="WFRuntimeServer.IWFRuntimeSrv,IWFRuntimeSrv" url ="tcp://172.16.8.108:4650/IPCService/CRuntimeSrv" />
</ client >
</ application >
</ system.runtime.remoting >
</ configuration >

转载于:https://www.cnblogs.com/kntao/archive/2011/02/12/2049762.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值