Пример #1
0
        private IHttpHandler CreateDefaultHandler(IHttpContext ctx, IServiceRequest req, DefaultServiceDispatcher serviceDispatcher)
        {
            Action invoke = () =>
            {
                IServiceResponse resp = null;
                try
                {
                    resp = serviceDispatcher.Dispatch(req);
                }
                catch (Exception e)
                {
                    throw e;
                }
                finally
                {
                    var disposalbe = serviceDispatcher as IDisposable;
                    if (disposalbe != null)
                        disposalbe.Dispose();

                    ServiceContext.Current = null;
                }

                try
                {
                    ResponseResolver.Execute(ctx, resp);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            };

            return new RequireSessionHttpHandler { Handler = invoke };
        }
Пример #2
0
        private Action CreateInvokeAction(IHttpContext ctx, IServiceRequest req, DefaultServiceDispatcher serviceDispatcher, IOperationDescriptor operationDescriptor)
        {
            Action invoke = () =>
            {
                IServiceResponse resp = null;
                try
                {
                    resp = serviceDispatcher.Execute(req, operationDescriptor);
                }
                catch (Exception e)
                {
                   throw  e;
                }
                finally
                {
                    var disposalbe = serviceDispatcher as IDisposable;
                    if (disposalbe != null)
                        disposalbe.Dispose();
                    ServiceDispatcherConfiguationItem.ListenManager.OnDispatched(req);
                    ServiceContext.Current = null;
                }

                try
                {
                    ResponseResolver.Execute(ctx, resp);
                }
                catch (Exception ex)
                {
                   throw ex;
                }
            };
            return invoke;
        }