public JsonResult TestComInfo() { Type t = Type.GetTypeFromCLSID(new Guid("F0E70DF1-66B0-40c2-8210-40CEBBB8A6DA")); object obj = System.Activator.CreateInstance(t); object r = t.InvokeMember("test", System.Reflection.BindingFlags.InvokeMethod, null, obj, null); return(RetUtil.SuccessData(r)); }
public JsonResult GetModelJson(string modelClass) { try { Type type = Type.GetType(modelClass); var obj = System.Activator.CreateInstance(type); return(RetUtil.SuccessData(obj)); } catch (Exception ex) { return(RetUtil.ExceptionErr(ex.Message)); } }
public JsonResult GetPersonInfo() { try { ReqPersonInfo req = GetReqObj <ReqPersonInfo>(this.HttpContext.Request.InputStream); var validator = new ReqPersonInfoValidator(); string validInfo = CommonUtil.Validate(req, validator); ResPersonInfo_DS data = InterfaceHNUtil.GetPersonInfo(req); return(RetUtil.SuccessData(data)); } catch (Exception ex) { return(RetUtil.ExceptionErr(ex.Message)); } }
public override void OnActionExecuting(ActionExecutingContext context) { DateTime d1 = DateTime.Now; try { var isDefineAllowAnonymous = false; var controllerActionDescriptor = context.ActionDescriptor.ControllerDescriptor; //context.HttpContext.Request.Body.Position = 0; ////string bodyStr = string.Empty; ////using (var reader = new StreamReader(context.HttpContext.Request.Body, Encoding.UTF8, true, 1024, true)) //using (var reader = new StreamReader(context.HttpContext.Request.Body, Encoding.UTF8)) //{ // var bodyRead = reader.ReadToEndAsync(); // bodyStr = bodyRead.Result; //把body赋值给bodyStr //} logger.Info($" ApiActionFilter {context.ActionDescriptor.ActionName} 执行开始..."); logger.Info($"Input: {bodyStr}"); if (controllerActionDescriptor != null) { isDefineAllowAnonymous = controllerActionDescriptor.GetCustomAttributes(inherit: true).Any(a => a.GetType().Equals(typeof(AllowAnonymousAttribute))); if (isDefineAllowAnonymous == false) { isDefineAllowAnonymous = context.ActionDescriptor.GetCustomAttributes(inherit: true).Any(a => a.GetType().Equals(typeof(AllowAnonymousAttribute))); } } base.OnActionExecuting(context); DateTime d2 = DateTime.Now; var ts = d2 - d1; if (ts.TotalSeconds >= 5) { logger.Warn(" ApiActionFilter 访问时间过长:" + ts.TotalMilliseconds.ToString()); } } catch (Exception ex) { context.Result = RetUtil.ExceptionErr(ex.Message); logger.Error(" ApiActionFilter 访问异常:" + ex.Message); logger.Info(" ApiActionFilter 访问异常:" + ex.Message); } }
public JsonResult TestInfo() { return(RetUtil.Success()); }