public async Task <Result <Pager <DbConfig> > > GetDbConfigs([FromBody] Para <DbConfig> para) { try { var query = para.Entity; if (query != null) { if (!string.IsNullOrEmpty(query.ConfigRemark)) { para.Filter = para.Filter.And(x => x.ConfigRemark.Contains(query.ConfigRemark)); } } var pageRes = await repo.QueryPageAsync(para); return(new Result <Pager <DbConfig> > { IsSucc = true, Data = pageRes }); } catch (Exception ex) { logHelper.Error("GetDbConfigs:获取数据库配置失败:" + ex.Message + " " + ex.StackTrace); } return(new Result <Pager <DbConfig> > { Message = "获取数据库配置失败!" }); }
public T SendGetRequest <T>(string address, string token = null) { HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest; request.Method = "GET"; request.ContentType = "application/json"; if (token != null) { request.Headers.Add("authorization", "bearer " + token); } request.Accept = "application/json"; request.Proxy = null; try { HttpWebResponse httpWebResponse = (HttpWebResponse)request.GetResponse(); string responseString = new StreamReader(httpWebResponse.GetResponseStream()).ReadToEnd(); return(JsonConvert.DeserializeObject <T>(responseString)); } catch (Exception exc) { logHelper.Error(exc, null); logHelper.Info(null, exc); } return(default(T)); }
/// <summary> /// 定时推送 /// </summary> /// <returns></returns> public async Task <Result> TimingPush() { // todo改成多线程推送 var dtNow = DateTime.Now; // 获取当前时间间隔在1分钟之内的任务 var lstPushConf = await repo.QueryAsync <WxAutoPushShow>(x => x.IsDel == 0 && x.PushTime >= dtNow.AddMinutes(-TimingSpanMin) && x.PushTime < dtNow.AddMinutes(TimingSpanMin)); foreach (var push in lstPushConf) { try { // 查询推送用户列表 logHelper.Debug("AutoPushJob:任务信息:" + ComHelper.JsonSerialize(push)); string strSql = Get2DayActWxUserSql(push); var lstWxUser = await repo.SqlQueryAsync <WxUserInfo>(strSql, new { CreateTime = dtNow.AddDays(-2) }); logHelper.Debug("AutoPushJob:符合任务ID:" + push.Id + "任务名:" + push.PushName + "的用户有:" + lstWxUser.Select(x => x.OpenId).Distinct().JsonSerializeNoNull()); // 推送消息 await PushMsgToUser(push, lstWxUser); } catch (Exception ex) { logHelper.Error("AutoPushJob:获取定时推送消息失败:" + ex.Message + " " + ex.StackTrace); } } return(new Result { IsSucc = true, Message = "定时推送任务执行完成!" }); }
/// <summary> /// 查询分页数据(返回符合要求的记录总数)+ GetPagedList /// </summary> /// <typeparam name="TKey">排序用到的键值</typeparam> /// <param name="pageIndex">页码索引,第几页</param> /// <param name="pageSize">页容量</param> /// <param name="rowsCount">总记录数</param> /// <param name="whereLambda">查询条件Linq表达式</param> /// <param name="orderBy">排序条件Linq表达式</param> /// <param name="isAsc">是否正序排列</param> /// <returns>符合要求的列表</returns> public virtual List <T> GetPagedList <TKey>(int pageIndex, int pageSize, out int rowsCount, Expression <Func <T, bool> > whereLambda, Expression <Func <T, TKey> > orderBy, bool isAsc = true) { try { //查询总的记录数 rowsCount = db.Set <T>().AsNoTracking().Where(whereLambda).Count(); // 分页 一定注意: Skip 之前一定要 OrderBy if (isAsc) { return(db.Set <T>().AsNoTracking().Where(whereLambda).OrderBy(orderBy) .Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList()); } else { return(db.Set <T>().AsNoTracking().Where(whereLambda).OrderByDescending(orderBy) .Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList()); } } catch (Exception ex) { rowsCount = -1; Logger.Error(ex); return(null); } }
/// <summary> /// 加密消息 /// </summary> /// <param name="msg">要加密的消息</param> /// <returns>加密后的消息</returns> public string EncryptMsg(string msg) { var encryptMsg = ""; var result = Wxcpt.EncryptMsg(msg, _timestamp, _nonce, ref encryptMsg); if (result != 0) { Logger.Error("微信消息加密失败,result:" + result); } return(encryptMsg); }
/// <summary> /// 验证 /// </summary> /// <param name="username"></param> /// <param name="password"></param> /// <returns></returns> public bool LdapAuthenticate(string username, string password) { var loginDN = username; var sAMAccountName = username; if (username.Contains(MailSuffix)) { sAMAccountName = username.Substring(0, username.IndexOf(MailSuffix)); } else { loginDN = $"{username}{MailSuffix}"; } var searchFilter = $"(sAMAccountName={sAMAccountName})"; try { var conn = new LdapConnection(); conn.Connect(LdapHost, LdapPort); conn.Bind(loginDN, password); var lsc = conn.Search(SearchBase, LdapConnection.SCOPE_SUB, searchFilter, Attrs, false); while (lsc.HasMore()) { LdapEntry nextEntry = null; try { nextEntry = lsc.Next(); if (nextEntry != null) { break; } } catch (LdapException ex) { logHelper.Error("LdapAuthenticate:ad认证出错:" + ex.Message + " " + ex.StackTrace); continue; } } conn.Disconnect(); return(true); } catch (Exception ex1) { logHelper.Error("LdapAuthenticate:ad认证出错:" + ex1.Message + " " + ex1.StackTrace); } return(false); }
/// <summary> /// 保存微信日志到数据库 /// </summary> /// <returns></returns> public async Task SaveWxOptLog(PubReceiveMsgCData recMsg) { try { // 判断是否重复提交 var exist = await repo.FirstOrDefaultAsync <WxUserOptLog>(d => d.FromUserName == recMsg.FromUserName && d.CreateTime == recMsg.DtCreateTime); if (exist != null) { logHelper.Debug("重复的微信请求(微信首次请求我方服务器已保存记录但未返回正确回应的二次请求),不保存!IopenId:" + recMsg.FromUserName); return; } // 保存微信日志 var wxLog = new WxUserOptLog(); wxLog.MsgId = recMsg.MsgId.ToString(); wxLog.ToUserName = recMsg.ToUserName; wxLog.FromUserName = recMsg.FromUserName; wxLog.CreateTime = recMsg.DtCreateTime.Value; wxLog.MsgType = recMsg.MsgType.ToString(); wxLog.Content = recMsg.Content; wxLog.PicUrl = recMsg.PicUrl; wxLog.MediaId = recMsg.MediaId; wxLog.Format = recMsg.Format; wxLog.ThumbMediaId = recMsg.ThumbMediaId; wxLog.LocationX_Latitude = recMsg.Location_X.ToString(); wxLog.LocationY_Longitude = recMsg.Location_Y.ToString(); wxLog.Scale = recMsg.Scale.ToString(); wxLog.LabelPrecision = recMsg.Label; wxLog.Title = recMsg.Title; wxLog.Description = recMsg.Description; wxLog.Url = recMsg.Url; wxLog.Event = recMsg.Event.ToString(); wxLog.EventKey = recMsg.EventKey; wxLog.Ticket = recMsg.Ticket; wxLog.Creater = "system"; wxLog.CreateTime = recMsg.DtCreateTime.Value; wxLog.Updater = "system"; wxLog.UpdateTime = recMsg.DtCreateTime.Value; await repo.SaveAsync(wxLog); logHelper.Debug("SaveWxDbLog:保存微信日志到数据成功:" + ComHelper.JsonSerialize(wxLog)); } catch (Exception ex) { logHelper.Error("SaveWxDbLog:保存微信日志到数据失败:" + ex.Message + " " + ex.StackTrace); } }
public IEnumerable <ApplicantModel> Get() { _LogHelper.Information(String.Format("Get regqest 'api/applicant has come.'")); try { List <ApplicantModel> applicants = _Mapper.Map <List <ApplicantModel> >(_ApplicantManager.GetAll()); return(applicants); } catch (Exception ex) { _LogHelper.Error(String.Format("Get regqest 'api/applicant got the followwing error: {0}", ex.ToString())); throw new ApiException(ex.Message, System.Net.HttpStatusCode.BadRequest); } }
public override void OnException(ExceptionContext filterContext) { if (filterContext != null) { var httpEx = new HttpException(null, filterContext.Exception); Logger.Error(httpEx); var errorCode = httpEx.GetHttpCode(); ViewResult view = null; switch (errorCode) { case 404: view = new ViewResult() { ViewName = "NotFound", MasterName = null }; break; default: view = new ViewResult() { ViewName = "Error", MasterName = null }; break; } filterContext.ExceptionHandled = true; filterContext.HttpContext.Response.Clear(); filterContext.Result = view; } }
public virtual void Edit(T entity) { try { Context.Entry(entity).State = EntityState.Modified; Context.SaveChanges(); } catch (DbEntityValidationException dbEx) { LogDbEntityErrors(dbEx); } catch (Exception ex) { log.Error("Save failed", ex); } }
public bool Start() { if (_webApp != null) { _webApp.Dispose(); _webApp = null; } _scheduler.Start(); try { // https://stackoverflow.com/questions/27168432/the-server-factory-could-not-be-located-for-the-given-input-microsoft-owin-host // _webApp = WebApp.Start("http://*:8200", app => { app.UseCrystalQuartz(_scheduler, new CrystalQuartzOptions { Path = "/quartz" }); }); Logger.Info("webapp started"); } catch (Exception ex) { Logger.Error("服务启动 webApp 失败", ex); } return(true); }
/// <summary> /// 登陆 /// </summary> /// <param name="login"></param> /// <returns></returns> public async Task <Result <LoginParam> > Login(LoginModel login) { try { var user = await repo.FirstOrDefaultAsync <UserInfoShow>(x => x.UserName == login.UserName); if (user != null && ComHelper.MD5Sign(login.Password) == user.UserPwd) { var jwtInfo = new TokenModelJwt { }; jwtInfo.Uid = user.Id; jwtInfo.UserName = user.UserName; // 查询用户的角色 var lstRoles = await repo.QueryAsync <PermUserRoleDto>(x => x.IsDel == 0 && x.UserName == user.UserName); jwtInfo.Role = string.Join(',', lstRoles.Select(x => x.RId).Distinct().ToList()); var token = await AuthHelper.GetJwtToken(jwtInfo); return(new Result <LoginParam> { IsSucc = true, Data = token }); } } catch (Exception ex) { logHelper.Error($"Login:登陆失败:{ex.Message}", ex); } return(new Result <LoginParam> { Message = "登录失败,请重试!" }); }
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Exception error = (Exception)e.ExceptionObject; ILogHelper logger = LogHelper.GetInstance(); logger.Error("未处理异常", error); }
/// <summary> /// 处理企业号推送事件 /// </summary> /// <param name="recMsg"></param> /// <returns></returns> public async Task <string> DealQyEvent(PubReceiveMsgCData recMsg) { try { switch (recMsg.Event) { case PubEventType.subscribe: await DealWxSubscribe(recMsg); // 关注后判断扫码事件处理 await DealWxscan(recMsg); break; case PubEventType.unsubscribe: await DealWxUnsubscribe(recMsg); break; case PubEventType.scan: await DealWxscan(recMsg); break; case PubEventType.location: logHelper.Debug("location"); break; case PubEventType.location_select: logHelper.Debug("location"); break; case PubEventType.click: await DealWxClick(recMsg); break; case PubEventType.view: logHelper.Debug("view"); break; case PubEventType.poi_check_notify: logHelper.Debug("poi_check_notify"); break; default: break; } } catch (Exception ex) { logHelper.Error("DealQyEvent:处理企业号推送事件失败:" + ex.Message + " " + ex.StackTrace); } return(wxAutoComResponse.ResponseOK());; }
/// <summary> /// 获取机器人回复 /// </summary> /// <param name="request">请求</param> /// <returns>回复信息</returns> public static string GetBotReply(string request) { try { var response = HttpHelper.HttpGetString(String.Format(QingyunkeRequestUrlFormat, request)); if (!string.IsNullOrEmpty(response)) { var res = ConvertHelper.JsonToObject <QingyunkeResponseModel>(response); if (res != null && res.Result == 0) { return(res.Content); } } } catch (Exception ex) { Logger.Error(ex); } return("error"); }
public void GetAllChannels() { //logHelper.Info("Sprawdzenie", null); //test ChannelList = new List <Channel2>(); foreach (var item in TeamList) { List <Channel2> temp = jsonHelper.SendGetRequest <List <Channel2> >($"{connectionURL}/api/v4/users/{User.Id}/teams/{item.Id}/channels", Token); if (temp == null) { logHelper.Error(null, "Coś poszło nie tak bo lista kanałów jest pusta"); Thread.Sleep(1000); temp = jsonHelper.SendGetRequest <List <Channel2> >($"{connectionURL}/api/v4/users/{User.Id}/teams/{item.Id}/channels", Token); if (temp == null) { logHelper.Error(null, "I dalej jest pusta"); } } ChannelList.AddRange(temp); } }
/// <summary> /// Make a POST request to an url with an oauth sign and an object in the body of the request as json /// </summary> /// <param name="url">Url to make the request</param> /// <param name="model">Object to send in the body request as json</param> /// <param name="acceptHeader">(Optional) Accept header</param> /// <returns>Response of the server</returns> protected string WebRequestPostWithJsonObject(string url, object model, string acceptHeader = "") { Dictionary <string, string> otherHeaders = new Dictionary <string, string>(); SendLockTokenForResource(model, otherHeaders); string json = JsonConvert.SerializeObject(model); HttpWebRequest webRequest = PrepareWebRequest("POST", url, json, "application/json", acceptHeader, otherHeaders); try { WebResponse response = webRequest.GetResponse(); UpdateLockTokenForResource(response, model); return(ReadWebResponse(response)); } catch (WebException ex) { string message = null; try { StreamReader sr = new StreamReader(ex.Response.GetResponseStream()); message = sr.ReadToEnd(); if (mLog != null) { mLog.Error($"{ex.Message}. \r\nResponse: {message}"); } } catch { } if (!string.IsNullOrEmpty(message)) { throw new GnossAPIException(message); } // Error reading the error response, throw the original exception throw; } }
public static void Error(string msg) { _logHelper.Error(msg); if (AppHelper.MainForm != null) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { //Size size = new Size(300,900); FrmTips.ShowTips(AppHelper.MainForm, msg, 5 * 1000, true, System.Drawing.ContentAlignment.BottomRight, null, TipsSizeMode.Large, null, TipsState.Error); }); } }
/// <summary> /// /// </summary> /// <param name="context"></param> public void OnException(ExceptionContext context) { var json = new JsonErrorResponse(); json.Message = context.Exception.Message;//错误信息 if (_env.IsDevelopment()) { json.DevelopmentMessage = context.Exception.StackTrace;//堆栈信息 } context.Result = new InternalServerErrorObjectResult(json); _loggerHelper.Error(json.Message, WriteLog(json.Message, context.Exception)); }
/// <summary> /// 联系客服 /// </summary> /// <param name="recMsg"></param> /// <returns></returns> public Result <string> ChatWithKf(PubReceiveMsgCData recMsg) { try { if (IsWorkTime() && IsIn5Min(recMsg.FromUserName) && IsKfMsg(recMsg)) { PubKfApi.SendTextMsg(recMsg.FromUserName, "正在为你转接在线客服,请稍后....."); var msg = PubMsgApi.BuildKfTransferMsg(recMsg.FromUserName, recMsg.ToUserName, recMsg.CreateTime); return(new Result <string> { IsSucc = true, Data = msg }); } } catch (Exception ex) { logHelper.Error("ChatWithKf:联系客服失败:" + ex.Message + " " + ex.StackTrace); } return(new Result <string> { Message = "联系客服失败!" }); }
public static string ReturnMessage(string postStr) { var responseContent = ""; try { var xmldoc = new XmlDocument(); xmldoc.LoadXml(postStr); var msgId = xmldoc.SelectSingleNode("/xml/MsgId")?.InnerText; if (msgId.IsNullOrEmpty()) { var firewall = RedisManager.GetFirewallClient($"wechatMsgFirewall-{msgId}", TimeSpan.FromSeconds(2)); if (!firewall.Hit()) { return(string.Empty); } } var msgType = xmldoc.SelectSingleNode("/xml/MsgType"); if (msgType != null) { switch (msgType.InnerText) { case "event": responseContent = EventHandle(xmldoc); //事件处理 break; case "text": responseContent = TextMsgHandle(xmldoc); //接受文本消息处理 break; case "image": responseContent = ImageMsgHandle(xmldoc); //图片消息 break; case "voice": responseContent = VoiceMsgHandleAsync(xmldoc); //语音消息 break; default: break; } } } catch (Exception ex) { Logger.Error("发生异常,异常信息:" + ex.Message + ex.StackTrace); } return(responseContent); }
/// <summary> /// AD登陆验证 /// </summary> /// <param name="userName"></param> /// <param name="userPwd"></param> /// <returns></returns> public bool Login(string userName, string userPwd) { try { var entry = GetDirectoryObject(userName, userPwd); Object native = entry.NativeObject; return(true); } catch (Exception ex) { logHelper.Error($"Ad:Login出错:{ex.Message}", ex); return(false); } }
public async Task <Result> Logout() { try { await AuthHelper.IdentifyLogout(); return(new Result { IsSucc = true }); } catch (Exception ex) { logHelper.Error($"Logout:退出登录失败:{ex.Message}", ex); } return(new Result { }); }
public async Task <Result> SeedData() { try { await sugarDbSeed.SeedAsync(); return(new Result { IsSucc = true, Message = "还原数据库成功!" }); } catch (Exception ex) { logHelper.Error($"SeedData:还原数据库失败:{ex.Message}", ex); } return(new Result { Message = "还原数据库失败!" }); }
/// <summary> /// 公众号推送Text处理 /// </summary> /// <param name="recMsg"></param> /// <returns></returns> public async Task <string> DealQyText(PubReceiveMsgCData recMsg) { try { // 用户 var gzhClient = recMsg.FromUserName; // 公众号 var gzhServer = recMsg.ToUserName; // 文本内容 var keyword = recMsg.Content.ToLower(); return(await wxAutoResponseHelper.DealWithKeyWord(gzhClient, gzhServer, keyword)); } catch (Exception ex) { logHelper.Error("DealQyText:处理Text出错:" + ex.Message + " " + ex.StackTrace); } return(wxAutoComResponse.ResponseOK()); }
/// <summary> /// 处理请求 /// </summary> /// <param name="context"></param> /// <returns></returns> public async Task InvokeAsync(HttpContext context) { // 过滤,只有接口 if (context.Request.Path.Value.Contains("api")) { //context.Request.EnableRewind(); context.Request.EnableBuffering(); Stream originalBody = context.Response.Body; try { // 存储请求数据 var reqMsg = await RequestDataLog(context.Request); using (var ms = new MemoryStream()) { context.Response.Body = ms; await _next(context); // 存储响应数据 var respMsg = await ResponseDataLog(context.Response, ms); _logHelper.ApiLog($"RequRespLogMildd:{reqMsg}{respMsg}"); ms.Position = 0; await ms.CopyToAsync(originalBody); } } catch (Exception ex) { // 记录异常 _logHelper.Error($"RequRespLogMildd:发生异常:{ex.Message}", ex); } finally { context.Response.Body = originalBody; } } else { await _next(context); } }
public async Task <Result <List <UploadRes> > > Upload([FromQuery] string upType = "files") { try { var lstUploadRes = new List <UploadRes> { }; // 获取上传目录的路径 var upRootInfo = GetUploadPath(upType); var files = Request.Form.Files; foreach (var file in files) { // 处理图片旋转 var finalStream = await GetFileFinStream(file); // 文件保存的路径 var fileUpInfo = GetFilePath(upRootInfo, file.FileName); // 保存文件 using (FileStream fs = new FileStream(fileUpInfo.PhyPath, FileMode.OpenOrCreate)) { finalStream.Seek(0, SeekOrigin.Begin); await finalStream.CopyToAsync(fs); await fs.FlushAsync(); } lstUploadRes.Add(fileUpInfo); } return(new Result <List <UploadRes> > { IsSucc = true, Message = "上传成功!", Data = lstUploadRes }); } catch (Exception ex) { logHelper.Error($"Upload:上传文件失败:{ex.Message}", ex); } return(new Result <List <UploadRes> > { Message = "上传失败!" }); }
/// <summary> /// 添加操作日志 /// </summary> /// <param name="logContent">日志内容</param> /// <param name="logModule">日志模块</param> /// <param name="operBy">操作人</param> /// <returns></returns> public static bool AddOperLog(string logContent, string logModule, string operBy) { try { var log = new OperationLog() { LogId = Guid.NewGuid(), LogContent = logContent, LogModule = logModule, IpAddress = HttpContext.Current.Request.UserHostAddress, OperBy = operBy, OperTime = DateTime.Now }; return(DependencyResolver.Current.GetService <IBLLOperationLog>().Add(log) == 1); } catch (Exception ex) { Logger.Error("添加操作日志失败", ex); } return(false); }
/// <summary> /// 自动推送红包(公众号自动回复) /// </summary> /// <param name="gzhClient"></param> /// <param name="gzhSever"></param> /// <param name="autoKeyword"></param> /// <param name="dtNow"></param> /// <param name="timeStamp"></param> /// <returns></returns> public async Task <string> SendResponseRedPack(string gzhClient, string gzhSever, WxAutoKeywordShow autoKeyword, DateTime dtNow, int timeStamp) { // 红包只能8点之后领取 if (dtNow.Hour < 8) { return(await wxAutoComResponse.SendWxText(gzhSever, gzhClient, timeStamp, "亲:微信红包将于8点到24点之间才能领取")); } // 红包参数配置 金额|个数|祝福语|红包名称|红包备注 if (autoKeyword.RedAmount <= 0 || autoKeyword.RedCount <= 0) { logHelper.Error("SendMsgByPush:红包配置失败!autoID:" + autoKeyword.Id); return(await wxAutoComResponse.SendWxText(gzhClient, gzhSever, timeStamp, "获取红包失败,请稍候重试!")); } // 红包已发放个数 var sendCount = repo.SqlQuerySingle <int>($" SELECT COUNT(1) FROM WxAutoKeywordDetail WHERE AutoId = {autoKeyword.Id} "); if (sendCount >= autoKeyword.RedCount) { logHelper.Error("SendMsgByPush:红包已经抢完,autoID:" + autoKeyword.Id); return(await wxAutoComResponse.SendWxText(gzhClient, gzhSever, timeStamp, "客官,您来晚了,红包已被先到的小伙伴抢完鸟,下次记得早点来哦。")); } // 判断用户是否已经发放过红包 var exist = repo.FirstOrDefault <WxAutoKeywordDetail>(x => x.Id == autoKeyword.Id && x.Opend == gzhClient); if (exist != null) { logHelper.Error("SendMsgByPush:重复领取红包,autoID:" + autoKeyword.Id + " OpenID:" + gzhClient); return(await wxAutoComResponse.SendWxText(gzhClient, gzhSever, timeStamp, "你已经领取过此红包,请把机会留给更多的人!")); } // 发放红包 var payRes = RedpackApi.SendPack(gzhClient, autoKeyword.RedAmount, autoKeyword.RedAct, autoKeyword.RedWish, autoKeyword.RedRemark, ""); if (payRes.IsSucc) { //红包发送成功 WxAutoKeywordDetail redHis = await SaveAutoKeywordHis(autoKeyword.Id, gzhClient); logHelper.Debug("SendMsgByPush:发送红包成功:" + redHis.JsonSerialize()); return(await wxAutoComResponse.SendWxText(gzhClient, gzhSever, timeStamp, "红包发放成功,请注意查收~~")); } else { logHelper.Error("SendMsgByPush:红包发送失败,错误码:" + payRes.err_code + " 错误描述" + payRes.err_code_des); return(await wxAutoComResponse.SendWxText(gzhClient, gzhSever, timeStamp, "微信服务器暂忙,请稍候重试。")); } }
public void OnAuthorization(AuthorizationContext filterContext) { var model = new WechatMsgRequestModel { Nonce = filterContext.HttpContext.Request.QueryString["nonce"], Signature = filterContext.HttpContext.Request.QueryString["signature"], Timestamp = filterContext.HttpContext.Request.QueryString["timestamp"], Msg_Signature = filterContext.HttpContext.Request.QueryString["msg_signature"] }; //验证 if (!CheckSignature(model)) { Logger.Error("微信请求签名验证不通过"); filterContext.Result = new ContentResult { Content = "微信请求验证失败", ContentEncoding = Encoding.UTF8, ContentType = "text/html" }; } }