您的位置:首页 > 其它

Remoting 配置文件遇到的问题

2011-02-12 16:14 197 查看
虽然是个小问题,但是也花了我不少的时间。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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐