private void SetAfterExecuteMethodCounters(SimpleRequestSoapMessage message, bool success)
        {
            this._ExecutionWatch.Stop();

            SetAfterExecuteMethodCounterValues(this._GlobalInstance, message, success);
            SetAfterExecuteMethodCounterValues(this._ActionInstance, message, success);
        }
        /// <summary>
        /// 创建一个消息
        /// </summary>
        /// <param name="inputStream"></param>
        /// <returns></returns>
        public static SimpleRequestSoapMessage CreateMessage(Stream inputStream)
        {
            SimpleRequestSoapMessage message = new SimpleRequestSoapMessage();

            message.InitFromStream(inputStream);

            return message;
        }
示例#3
0
        /// <summary>
        /// 创建一个消息
        /// </summary>
        /// <param name="inputStream"></param>
        /// <returns></returns>
        public static SimpleRequestSoapMessage CreateMessage(Stream inputStream)
        {
            SimpleRequestSoapMessage message = new SimpleRequestSoapMessage();

            message.InitFromStream(inputStream);

            return(message);
        }
        /// <summary>
        /// 创建消息
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="serviceName"></param>
        /// <returns></returns>
        protected virtual SimpleRequestSoapMessage CreateMessage(Stream stream, string serviceName)
        {
            SimpleRequestSoapMessage message = SimpleRequestSoapMessage.CreateMessage(stream);

            message.ServiceName = serviceName;

            return(message);
        }
        private string GetDataInCache(SimpleRequestSoapMessage requestMessage)
        {
            string result = null;

            ServiceMethodCache methodCache = null;

            if (this.GetMethodCacheManager().TryGetValue(requestMessage.MethodCacheKey, out methodCache))
            {
                methodCache.TryGetValue(requestMessage.Document.OuterXml, out result);
            }

            return(result);
        }
        private static ServiceMethodConfigurationElement GetMethodSettings(SimpleRequestSoapMessage requestMessage)
        {
            ServiceSettings settings = ServiceSettings.GetConfig();

            ServiceMethodConfigurationElement result = null;

            ServiceConfigurationElement serviceElement = settings.Services[requestMessage.ServiceName];

            if (serviceElement != null)
            {
                result = serviceElement.Methods[requestMessage.Action];
            }

            return(result ?? settings.MethodDefaultSettings);
        }
        private void InitParameters(SimpleRequestSoapMessage message)
        {
            if (this._InstanceName == null)
            {
                this._InstanceName = message.Action + " of " + this._Initializer;
                this._InstanceName = this._InstanceName.Replace('/', '-');
                this._InstanceName = this._InstanceName.Replace('\\', '-');
            }

            if (this._ExecutionWatch == null)
            {
                this._ExecutionWatch = new Stopwatch();
                this._ExecutionWatch.Start();
            }
        }
        private void InitStreamAndMessage(SoapMessage message)
        {
            this._NewStream.Position = 0;
            this._OldStream.CopyTo(this._NewStream);
            this._NewStream.Position = 0;

            this._RequestMessage = this.CreateMessage(this._NewStream, this._Initializer.ServiceName);

            SimpleRequestSoapMessage.Current = this._RequestMessage;

            if (SimpleRequestSoapMessage.Current.Context.ContainsKey("TenantCode"))
            {
                TenantContext.Current.TenantCode = SimpleRequestSoapMessage.Current.Context.GetValue("TenantCode", string.Empty);
            }

            this._NewStream.Position = 0;
        }
        private void SetAfterExecuteMethodCounterValues(WebMethodServerCounters instance, SimpleRequestSoapMessage message, bool success)
        {
            instance.RequestAverageDurationBase.Increment();
            instance.RequestAverageDuration.IncrementBy(this._ExecutionWatch.ElapsedMilliseconds / 100);

            if (success)
            {
                instance.RequestSuccessCount.Increment();
            }
            else
            {
                instance.RequestFailCount.Increment();
            }

            instance.RequestsPerSecond.Increment();
        }
 private void SetBeforeExecuteMethodCounters(SimpleRequestSoapMessage message)
 {
     this._GlobalInstance.RequestCount.Increment();
     this._ActionInstance.RequestCount.Increment();
 }