//	获得一个AppServer服务器提供的远程对象
        //	入口参数:
        //		Type		interfaceType			接口类型
        public static object GetAppSvrObj(Type interfaceType, RemotingContextData _contextData)
        {
            //	目前发现有时候如果服务器端抛出异常,客户端截获后, 当前线程的CallContext会丢失
            //	由于目前目前程序是将用户当前身份放在CallContext中的, 所以导致问题
            //	因此,在下面的代码中添加一行,每次GetAppSvrObj的时候强制将当前用户身份设置到CallContext中
            //	此方案要求每次用户调用remoteObj之前都必须调用GetAppSvrObj,而不能GetAppSvrObj之后长期使用
            RemotingUserCTX.SetCurUser(SessionClass.CurrentSinoUser);

            if (ConfigFile.ICS_Channel == Config_IcsChannel.Tcp)
            {
                return(RemotingUtils.GetObject(interfaceType, ConfigFile.ICS_UriPrefix_TCP, _contextData));
            }
            else
            {
                return(RemotingUtils.GetObject(interfaceType, ConfigFile.ICS_UriPrefix_HTTP, _contextData));
            }
        }
Exemple #2
0
 public static object GetObject(Type type, string remotingSvcUriPrefix, RemotingContextData _contextData)
 {
     CallContext.SetData(_contextData.ChannelName, _contextData.ContextData);
     return(Activator.GetObject(type, remotingSvcUriPrefix + type.ToString()));
 }