Remoting 配置文件遇到的问题

配置Windows Remoting服务
本文介绍如何正确配置并使用Windows下的Remoting服务。通过在Global.asax文件中调用RemotingConfiguration.Configure方法来加载配置文件,确保应用程序可以成功连接到远程服务。文中还提供了具体的配置文件示例。

虽然是个小问题,但是也花了我不少的时间。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>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值