Ejemplo n.º 1
0
        /// <summary>
        /// After receiving a request, do any message stuff here
        /// </summary>
        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            try
            {
                // Handle compressed requests
                var compressionScheme = CompressionUtil.GetCompressionScheme(WebOperationContext.Current.IncomingRequest.Headers[System.Net.HttpRequestHeader.ContentEncoding]);
                if (compressionScheme != null)
                {
                    CompressionUtil.DeCompressMessage(ref request, compressionScheme, this.GetContentFormat(request));
                }

                return(null);
            }
            catch (Exception e)
            {
                this.m_traceSource.TraceEvent(TraceEventType.Error, e.HResult, e.ToString());
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// After receiving a request, do any message stuff here
        /// </summary>
        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            try
            {
                this.m_traceSource.TraceEvent(TraceEventType.Verbose, 0, "Received request from {0} : {1} {2} ({3})", (OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty)?.Address.ToString(),
                                              WebOperationContext.Current.IncomingRequest.Method,
                                              WebOperationContext.Current.IncomingRequest.UriTemplateMatch.RequestUri,
                                              WebOperationContext.Current.IncomingRequest.UserAgent);
                // Handle compressed requests
                var compressionScheme = CompressionUtil.GetCompressionScheme(WebOperationContext.Current.IncomingRequest.Headers[System.Net.HttpRequestHeader.ContentEncoding]);
                if (compressionScheme != null)
                {
                    CompressionUtil.DeCompressMessage(ref request, compressionScheme, this.GetContentFormat(request));
                }

                return(null);
            }
            catch (Exception e)
            {
                this.m_traceSource.TraceEvent(TraceEventType.Error, e.HResult, e.ToString());
                return(null);
            }
        }