protected void CoreProcessRequest()
        {
            try {
                bool transacted = protocol.MethodAttribute.TransactionEnabled;
                if (protocol.IsOneWay)
                {
                    WorkItemCallback callback       = null;
                    TraceMethod      callbackMethod = null;
                    if (protocol.OnewayInitException != null)
                    {
                        callback       = new WorkItemCallback(this.ThrowInitException);
                        callbackMethod = Tracing.On ? new TraceMethod(this, "ThrowInitException") : null;
                    }
                    else
                    {
                        parameters     = protocol.ReadParameters();
                        callback       = transacted ? new WorkItemCallback(this.OneWayInvokeTransacted) : new WorkItemCallback(this.OneWayInvoke);
                        callbackMethod = Tracing.On ? transacted ? new TraceMethod(this, "OneWayInvokeTransacted") : new TraceMethod(this, "OneWayInvoke") : null;
                    }

                    if (Tracing.On)
                    {
                        Tracing.Information(Res.TracePostWorkItemIn, callbackMethod);
                    }
                    WorkItem.Post(callback);
                    if (Tracing.On)
                    {
                        Tracing.Information(Res.TracePostWorkItemOut, callbackMethod);
                    }

                    protocol.WriteOneWayResponse();
                }
                else if (transacted)
                {
                    parameters = protocol.ReadParameters();
                    InvokeTransacted();
                }
                else
                {
                    parameters = protocol.ReadParameters();
                    Invoke();
                }
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Error, this, "CoreProcessRequest", e);
                }
                if (!protocol.IsOneWay)
                {
                    WriteException(e);
                }
            }

            TraceFlush();
        }
        void Invoke()
        {
            PrepareContext();
            object[] parameters = protocol.ReadParameters();
            protocol.CreateServerInstance();

            string         stringBuffer;
            RemoteDebugger debugger = null;

            if (!protocol.IsOneWay && RemoteDebugger.IsServerCallInEnabled(protocol, out stringBuffer))
            {
                debugger = new RemoteDebugger();
                debugger.NotifyServerCallEnter(protocol, stringBuffer);
            }

            try {
                object[] returnValues = protocol.MethodInfo.Invoke(protocol.Target, parameters);
                WriteReturns(returnValues);
            }
            catch (Exception e) {
                if (!protocol.IsOneWay)
                {
                    WriteException(e);
                }
                throw;
            }
            finally {
                protocol.DisposeServerInstance();

                if (debugger != null)
                {
                    debugger.NotifyServerCallExit(protocol.Response);
                }
            }
        }