Ejemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            #region  初始化配置
            var sysConfPath = Server.MapPath("/App_Data/SysConfKey.xml");
            var SMSConfPath = Server.MapPath("/App_Data/SMSConfig.xml");
            ThreadPool.QueueUserWorkItem(o =>
            {
                #region 系统配置
                var keys   = YunXiu.Commom.CommomClass.GetXmlNodeValue(sysConfPath, "/keys/key");
                var isLoad = YunXiu.Commom.CommomClass.LoadConfigDictionary(keys);
                if (!isLoad)
                {
                    //如果配置没有加载成功通知运维
                }
                #endregion

                #region 短信供应商配置
                GlobalDictionary.SMSConfDic = CommomClass.GetXmlNodeVal(SMSConfPath, "/SMS/SMSProvider[IsUse=1]");
                #endregion
            });
            #endregion

            #region 初始化库存
            ThreadPool.QueueUserWorkItem(o =>
            {
                // ProductStock_Cache cache = new ProductStock_Cache();
                ProductStock_BLL productStockBLL = new ProductStock_BLL();
                //  cache.SaveProductStock(productStockBLL.GetProductStock());
            });
            #endregion

            #region 读取MQ的订单(MSMQ)
            MSMQ m = new MSMQ
            {
                MSMQIP   = "192.168.9.32",
                MSMQName = "orderQueue"
            };

            ThreadPool.QueueUserWorkItem(o =>
            {
                while (true)
                {
                    Thread.Sleep(100);
                    m.BeginReceive("", "");
                    m.receiveComplete += MQMQReceiveComplete;
                }
            });
            #endregion
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            #region  初始化配置
            var sysConfPath = Server.MapPath("/App_Data/SysConf.xml");
            var SMSConfPath = Server.MapPath("/App_Data/SMSConfig.xml");
            ThreadPool.QueueUserWorkItem(o =>
            {
                #region 系统配置
                GlobalDictionary.SysConfDictionary = CommomClass.GetXmlNodeVal(sysConfPath, "/Sys");
                #endregion

                #region 短信供应商配置
                GlobalDictionary.SMSConfDic = CommomClass.GetXmlNodeVal(SMSConfPath, "/SMS/SMSProvider[IsUse=1]");
                #endregion
            });
            #endregion
        }