/// <summary>
        /// 调用。
        /// </summary>
        /// <param name="context">处理上下文。</param>
        /// <returns>任务。</returns>
        public override Task Invoke(IHandlerContext context)
        {
            var dependencyResolver    = context.GetDependencyResolver();
            var requestMessageFactory = dependencyResolver.GetService <IRequestMessageFactory>();

            var content    = context.Content;
            var parameters = context.GetRequestParameters();


            if (parameters.ContainsKey("encrypt_type"))
            {
                var nonce     = parameters["nonce"];
                var signature = parameters["msg_signature"];
                var timestamp = parameters["timestamp"];

                var baseInfo       = context.GetMessageHandlerBaseInfo();
                var appId          = baseInfo.AppId;
                var encodingAesKey = baseInfo.EncodingAesKey;
                var token          = baseInfo.Token;

                var wxBizMsgCrypt = new WXBizMsgCrypt(token, encodingAesKey, appId);
                wxBizMsgCrypt.DecryptMsg(signature, timestamp, nonce, content, ref content);
            }


            context.SetRequestMessage(requestMessageFactory.CreateRequestMessage(content));

            return(Next.Invoke(context));
        }
        /// <summary>
        /// 调用。
        /// </summary>
        /// <param name="context">处理上下文。</param>
        /// <returns>任务。</returns>
        public override Task Invoke(IHandlerContext context)
        {
            var request               = context.Request;
            var dependencyResolver    = context.GetDependencyResolver();
            var requestMessageFactory = dependencyResolver.GetService <IRequestMessageFactory>();

            var content = Encoding.UTF8.GetString(request.InputStream.ReadBytes());

            #region Decrypt

            var encryptType = request.QueryString["encrypt_type"];

            if (encryptType != null)
            {
                var nonce     = request.QueryString["nonce"];
                var signature = request.QueryString["msg_signature"];
                var timestamp = request.QueryString["timestamp"];

                var baseInfo       = context.GetMessageHandlerBaseInfo();
                var appId          = baseInfo.AppId;
                var encodingAesKey = baseInfo.EncodingAesKey;
                var token          = baseInfo.Token;

                var wxBizMsgCrypt = new WXBizMsgCrypt(token, encodingAesKey, appId);
                wxBizMsgCrypt.DecryptMsg(signature, timestamp, nonce, content, ref content);
            }

            #endregion Decrypt

            context.SetRequestMessage(requestMessageFactory.CreateRequestMessage(content));

            return(Next.Invoke(context));
        }
        /// <summary>
        /// ���á�
        /// </summary>
        /// <param name="context">���������ġ�</param>
        /// <returns>����</returns>
        public override Task Invoke(IHandlerContext context)
        {
            var request = context.Request;
            var dependencyResolver = context.GetDependencyResolver();
            var requestMessageFactory = dependencyResolver.GetService<IRequestMessageFactory>();

            var content = Encoding.UTF8.GetString(request.InputStream.ReadBytes());

            #region Decrypt

            var encryptType = request.QueryString["encrypt_type"];

            if (encryptType != null)
            {
                var nonce = request.QueryString["nonce"];
                var signature = request.QueryString["msg_signature"];
                var timestamp = request.QueryString["timestamp"];

                var baseInfo = context.GetMessageHandlerBaseInfo();
                var appId = baseInfo.AppId;
                var encodingAesKey = baseInfo.EncodingAesKey;
                var token = baseInfo.Token;

                var wxBizMsgCrypt = new WXBizMsgCrypt(token, encodingAesKey, appId);
                wxBizMsgCrypt.DecryptMsg(signature, timestamp, nonce, content, ref content);
            }

            #endregion Decrypt

            context.SetRequestMessage(requestMessageFactory.CreateRequestMessage(content));

            return Next.Invoke(context);
        }