Ejemplo n.º 1
0
        public Message EndRequest(IAsyncResult result)
        {
            Message message2;

            if (result == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result");
            }
            IAsyncRequest request = result as IAsyncRequest;

            if (request == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("result", System.ServiceModel.SR.GetString("InvalidAsyncResult"));
            }
            try
            {
                Message message = request.End();
                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    TraceUtility.TraceEvent(TraceEventType.Information, 0x40015, System.ServiceModel.SR.GetString("TraceCodeRequestChannelReplyReceived"), message);
                }
                message2 = message;
            }
            finally
            {
                this.ReleaseRequest(request);
            }
            return(message2);
        }
Ejemplo n.º 2
0
        public Message EndRequest(IAsyncResult result)
        {
            if (result == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("result");
            }

            IAsyncRequest asyncRequest = result as IAsyncRequest;

            if (asyncRequest == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("result", SR.GetString(SR.InvalidAsyncResult));
            }

            try
            {
                Message reply = asyncRequest.End();

                if (DiagnosticUtility.ShouldTraceInformation)
                {
                    TraceUtility.TraceEvent(TraceEventType.Information, TraceCode.RequestChannelReplyReceived,
                                            SR.GetString(SR.TraceCodeRequestChannelReplyReceived), reply);
                }

                return(reply);
            }
            finally
            {
                ReleaseRequest(asyncRequest);
            }
        }