예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            string   strRemotingPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LBRemoting.Config");
            IniClass iniClass        = new IniClass(strRemotingPath);
            string   strPort         = iniClass.ReadValue("Remoting", "Port");
            string   strServerName   = iniClass.ReadValue("Remoting", "ServerName");
            string   strServerURL    = iniClass.ReadValue("Remoting", "ServerURL");
            string   strDBName       = iniClass.ReadValue("Remoting", "DBName");
            string   strDBServer     = iniClass.ReadValue("Remoting", "DBServer");

            bool   bolLoginSecure       = iniClass.ReadValue("Remoting", "LoginSecure") == "1" ? true : false;
            string strDBUser            = iniClass.ReadValue("Remoting", "DBUser");
            string strDBPW              = iniClass.ReadValue("Remoting", "DBPW");
            string strWebServiceAddress = iniClass.ReadValue("Remoting", "WebServiceAddress");
            //WriteLog("读取数据库名称:"+ strDBName+" 地址:"+ strAddress);
            int mPort;

            int.TryParse(strPort, out mPort);
            strServerName = "LRB";
            HttpChannel channel = new HttpChannel(mPort);

            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(WebRemoting), strServerName, WellKnownObjectMode.Singleton);

            WebRemoting.SetRemotingInfo(strDBName, strDBServer, bolLoginSecure, strDBUser, strDBPW, strWebServiceAddress);
            WebRemoting.LoadAllBLLFunction();
        }
예제 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            LB.Web.Encrypt.LBEncrypt.Decrypt();//校验注册信息

            string   strRemotingPath  = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LBRemoting.Config");
            IniClass iniClass         = new IniClass(strRemotingPath);
            string   strPort          = iniClass.ReadValue("Remoting", "Port");
            string   strServerName    = iniClass.ReadValue("Remoting", "ServerName");
            string   strServerURL     = iniClass.ReadValue("Remoting", "ServerURL");
            string   strDBName        = iniClass.ReadValue("Remoting", "DBName");
            string   strCurrentDirect = Directory.GetCurrentDirectory();
            string   strDBData        = Path.Combine(strCurrentDirect, "DBData");
            string   strDBServer      = iniClass.ReadValue("Remoting", "DBServer");

            if (Directory.Exists(strDBData))
            {
                strDBServer = strDBData;
            }
            else
            {
                strDBServer = iniClass.ReadValue("Remoting", "DBServer");
            }

            string strDBType      = iniClass.ReadValue("Remoting", "DBType");
            bool   bolLoginSecure = iniClass.ReadValue("Remoting", "LoginSecure") == "1" ? true : false;
            string strDBUser      = iniClass.ReadValue("Remoting", "DBUser");
            string strDBPW        = iniClass.ReadValue("Remoting", "DBPW");
            int    iDBType;

            int.TryParse(strDBType, out iDBType);
            //int iDBType = string.IsNullOrWhiteSpace(strDBType) ? 0 : 1;
            //WriteLog("读取数据库名称:"+ strDBName+" 地址:"+ strAddress);
            int mPort;

            int.TryParse(strPort, out mPort);
            strServerName = "LRB";
            HttpChannel channel = new HttpChannel(mPort);

            ChannelServices.RegisterChannel(channel, false);

            if (iDBType == 0)
            {
                RemotingConfiguration.RegisterWellKnownServiceType(
                    typeof(WebRemoting), strServerName, WellKnownObjectMode.Singleton);

                WebRemoting.SetRemotingInfo(strDBName, strDBServer, strDBUser, iDBType);
                WebRemoting.LoadAllBLLFunction();
            }
            else
            {
                RemotingConfiguration.RegisterWellKnownServiceType(
                    typeof(WebRemotingSQLServer), strServerName, WellKnownObjectMode.Singleton);

                WebRemotingSQLServer.SetRemotingInfo(strDBName, strDBServer, bolLoginSecure, strDBUser, strDBPW);
                WebRemotingSQLServer.LoadAllBLLFunction();
            }
        }