Exemplo n.º 1
0
        ///
        public static void Write(string module, string content)
        {
            if (string.IsNullOrWhiteSpace(content))
            {
                throw new ArgumentNullException(content);
            }

            string appid = ConfigurationManager.AppSettings["appid"];


            var info = new
            {
                Module = module,
                Content = content,
                ClientIP = Arch.CFramework.Utility.IPHelper.GetClientIP(),
                UserID = Authorization.Instance.CurrentUser() != null ? Authorization.Instance.CurrentUser().UserID : "白名单",
                AppID = appid
            };

            Task.Factory.StartNew(() =>
               {
                   try
                   {
                       string url = CentralConfig.GetValue(AppConst.CFX_Center_ServiceUrl, DefaultCenter_serviceUrl).TrimEnd('/');
                       if (!string.IsNullOrWhiteSpace(url))
                       {
                           AppInternals.Serialization.JSONSerialize.JSONParameters par = new AppInternals.Serialization.JSONSerialize.JSONParameters();
                           par.UseUTCDateTime = false;
                           string json = Arch.CFramework.AppInternals.Serialization.JSONSerialize.JSON.Instance.ToJSON(info, par);
                           HttpHelper.Post(url + "/api/LogWriter/Create", DataType.JSON, json);
                       }
                   }
                   catch (Exception ex)
                   { }

               });

        }
Exemplo n.º 2
0
        private void SendToMonitor(string hFullName, bool state)
        {
            try
            {
                string appid = System.Configuration.ConfigurationManager.AppSettings[AppConst.AppID];
                string url = CentralConfig.GetValue(AppConst.CFX_Monitor_ServiceUrl);
                if (!(string.IsNullOrWhiteSpace(url) || string.IsNullOrWhiteSpace(appid)))
                {

                    var info = new
                    {
                        AppID = appid,
                        MName = Environment.MachineName,
                        IP = IPHelper.GetIPddresses(),
                        State = state ? 1 : 0,
                        HFullName = hFullName
                    };
                    HttpHelper.Post(url, DataType.JSON, DynamicJson.Serialize(info));
                }
            }
            catch
            {
            }

        }