当前位置: 首页>>代码示例>>C#>>正文


C# RequestContext.Abort方法代码示例

本文整理汇总了C#中System.ServiceModel.Channels.RequestContext.Abort方法的典型用法代码示例。如果您正苦于以下问题:C# RequestContext.Abort方法的具体用法?C# RequestContext.Abort怎么用?C# RequestContext.Abort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.Channels.RequestContext的用法示例。


在下文中一共展示了RequestContext.Abort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: lock

 void IDisposable.Dispose()
 {
     RequestContext context;
     bool flag = false;
     lock (this.thisLock)
     {
         if (this.context == null)
         {
             return;
         }
         context = this.context;
         this.context = null;
     }
     try
     {
         context.Close();
         flag = true;
     }
     catch (CommunicationException exception)
     {
         if (DiagnosticUtility.ShouldTraceInformation)
         {
             DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
         }
     }
     catch (TimeoutException exception2)
     {
         if (DiagnosticUtility.ShouldTraceInformation)
         {
             DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
         }
     }
     finally
     {
         if (!flag)
         {
             context.Abort();
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:40,代码来源:RequestContextMessageProperty.cs

示例2: AbortRequestContext

        void AbortRequestContext(RequestContext requestContext)
        {
            try
            {
                requestContext.Abort();

                ReceiveContextRPCFacet receiveContext = this.ReceiveContext;

                if (receiveContext != null)
                {
                    this.ReceiveContext = null;
                    IAsyncResult result = receiveContext.BeginAbandon(
                        TimeSpan.MaxValue,
                        handleEndAbandon,
                        new CallbackState
                        {
                            ReceiveContext = receiveContext,
                            ChannelHandler = this.channelHandler
                        });

                    if (result.CompletedSynchronously)
                    {
                        receiveContext.EndAbandon(result);
                    }
                }
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                this.channelHandler.HandleError(e);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:MessageRpc.cs

示例3: HandleErrorContinuation

        bool HandleErrorContinuation(Exception e, RequestContext request, ServiceChannel channel, ref ErrorHandlerFaultInfo faultInfo, bool replied)
        {
            if (replied)
            {
                try
                {
                    request.Close();
                }
                catch (Exception e1)
                {
                    if (Fx.IsFatal(e1))
                    {
                        throw;
                    }
                    this.HandleError(e1);
                }
            }
            else
            {
                request.Abort();
            }
            if (!this.HandleError(e, ref faultInfo) && this.hasSession)
            {
                if (channel != null)
                {
                    if (replied)
                    {
                        TimeoutHelper timeoutHelper = new TimeoutHelper(CloseAfterFaultTimeout);
                        try
                        {
                            channel.Close(timeoutHelper.RemainingTime());
                        }
                        catch (Exception e2)
                        {
                            if (Fx.IsFatal(e2))
                            {
                                throw;
                            }
                            this.HandleError(e2);
                        }
                        try
                        {
                            this.binder.CloseAfterFault(timeoutHelper.RemainingTime());
                        }
                        catch (Exception e3)
                        {
                            if (Fx.IsFatal(e3))
                            {
                                throw;
                            }
                            this.HandleError(e3);
                        }
                    }
                    else
                    {
                        channel.Abort();
                        this.binder.Abort();
                    }
                }
                else
                {
                    if (replied)
                    {
                        try
                        {
                            this.binder.CloseAfterFault(CloseAfterFaultTimeout);
                        }
                        catch (Exception e4)
                        {
                            if (Fx.IsFatal(e4))
                            {
                                throw;
                            }
                            this.HandleError(e4);
                        }
                    }
                    else
                    {
                        this.binder.Abort();
                    }
                }
            }

            return true;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:85,代码来源:ChannelHandler.cs

示例4: TryRetrievingInstanceContext

        bool TryRetrievingInstanceContext(RequestContext request)
        {
            try
            {
                return TryRetrievingInstanceContextCore(request);
            }
            catch (Exception ex)
            {
                if (Fx.IsFatal(ex))
                {
                    throw;
                }

                DiagnosticUtility.TraceHandledException(ex, TraceEventType.Error);

                try
                {
                    request.Close();
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }

                    request.Abort();
                }

                return false;
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:32,代码来源:ChannelHandler.cs

示例5: OnLocalFault

        public void OnLocalFault(Exception e, Message faultMessage, RequestContext context)
        {
            if (this.channel.Aborted ||
                this.channel.State == CommunicationState.Faulted ||
                this.channel.State == CommunicationState.Closed)
            {
                if (faultMessage != null)
                    faultMessage.Close();
                if (context != null)
                    context.Abort();
                return;
            }

            lock (this.ThisLock)
            {
                if (this.faulted != SessionFaultState.NotFaulted)
                    return;
                this.faulted = SessionFaultState.LocallyFaulted;
                this.terminatingFault = faultMessage;
                this.replyFaultContext = context;
            }

            this.FaultCore();
            this.channel.Fault(e);
            this.UnblockChannelIfNecessary();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:26,代码来源:ChannelReliableSession.cs

示例6: AbortRequestContext

 private void AbortRequestContext(RequestContext requestContext)
 {
     try
     {
         requestContext.Abort();
     }
     catch (Exception e)
     {
         if (Fx.IsFatal(e))
         {
             throw;
         }
         this.channelHandler.HandleError(e);
     }
 }
开发者ID:weshaggard,项目名称:wcf,代码行数:15,代码来源:MessageRpc.cs

示例7: HandleRequest

        bool HandleRequest(IReplyChannel channel, RequestContext context)
        {
            if (context == null)
            {
                channel.Close();
                return false;
            }

            try
            {
                serviceManager.HandleRequest(context);
            }
            catch (CommunicationException)
            {
                context.Abort();
            }
            finally
            {
                context.Close();
            }
            return true;
        }
开发者ID:ssickles,项目名称:archive,代码行数:22,代码来源:Service.cs

示例8: HandleError

 private bool HandleError(Exception e, RequestContext request, ServiceChannel channel)
 {
     bool flag;
     ErrorHandlerFaultInfo faultInfo = new ErrorHandlerFaultInfo(this.messageVersion.Addressing.DefaultFaultAction);
     this.ProvideFaultAndReplyFailure(request, e, ref faultInfo, out flag);
     if (flag)
     {
         try
         {
             request.Close();
         }
         catch (Exception exception)
         {
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             this.HandleError(exception);
         }
     }
     else
     {
         request.Abort();
     }
     if (!this.HandleError(e, ref faultInfo) && this.hasSession)
     {
         if (channel != null)
         {
             if (flag)
             {
                 TimeoutHelper helper = new TimeoutHelper(CloseAfterFaultTimeout);
                 try
                 {
                     channel.Close(helper.RemainingTime());
                 }
                 catch (Exception exception2)
                 {
                     if (Fx.IsFatal(exception2))
                     {
                         throw;
                     }
                     this.HandleError(exception2);
                 }
                 try
                 {
                     this.binder.CloseAfterFault(helper.RemainingTime());
                     goto Label_0117;
                 }
                 catch (Exception exception3)
                 {
                     if (Fx.IsFatal(exception3))
                     {
                         throw;
                     }
                     this.HandleError(exception3);
                     goto Label_0117;
                 }
             }
             channel.Abort();
             this.binder.Abort();
         }
         else
         {
             if (flag)
             {
                 try
                 {
                     this.binder.CloseAfterFault(CloseAfterFaultTimeout);
                     goto Label_0117;
                 }
                 catch (Exception exception4)
                 {
                     if (Fx.IsFatal(exception4))
                     {
                         throw;
                     }
                     this.HandleError(exception4);
                     goto Label_0117;
                 }
             }
             this.binder.Abort();
         }
     }
 Label_0117:
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:86,代码来源:ChannelHandler.cs


注:本文中的System.ServiceModel.Channels.RequestContext.Abort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。