• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Dispatcher.MessageRpc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.ServiceModel.Dispatcher.MessageRpc的典型用法代码示例。如果您正苦于以下问题:C# MessageRpc类的具体用法?C# MessageRpc怎么用?C# MessageRpc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MessageRpc类属于System.ServiceModel.Dispatcher命名空间,在下文中一共展示了MessageRpc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AfterReply

 internal void AfterReply(ref MessageRpc rpc)
 {
     if (rpc.Operation.IsTerminating && rpc.Channel.HasSession)
     {
         new IOThreadTimer(new Action<object>(TerminatingOperationBehavior.AbortChannel), rpc.Channel.Binder.Channel, false).Set(rpc.Channel.CloseTimeout);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:TerminatingOperationBehavior.cs


示例2: CreateIfRequired

 public static void CreateIfRequired(ImmutableDispatchRuntime dispatchRuntime, ref MessageRpc messageRpc)
 {
     if (messageRpc.Operation.ReceiveContextAcknowledgementMode != ReceiveContextAcknowledgementMode.ManualAcknowledgement)
     {
         ReceiveContext property = null;
         if (!ReceiveContext.TryGet(messageRpc.Request, out property))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxReceiveContextPropertyMissing", new object[] { typeof(ReceiveContext).Name })));
         }
         messageRpc.Request.Properties.Remove(ReceiveContext.Name);
         if ((messageRpc.Operation.ReceiveContextAcknowledgementMode == ReceiveContextAcknowledgementMode.AutoAcknowledgeOnReceive) && !messageRpc.Operation.TransactionRequired)
         {
             AcknowledgementCompleteCallbackState state = new AcknowledgementCompleteCallbackState {
                 DispatchRuntime = dispatchRuntime,
                 Rpc = messageRpc
             };
             IAsyncResult result = new AcknowledgementCompleteAsyncResult(property, TimeSpan.MaxValue, ref messageRpc, null, handleEndComplete, state);
             if (result.CompletedSynchronously)
             {
                 AcknowledgementCompleteAsyncResult.End(result);
             }
         }
         else
         {
             messageRpc.ReceiveContext = new ReceiveContextRPCFacet(property);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:ReceiveContextRPCFacet.cs


示例3: ProvideMessageFault

 internal void ProvideMessageFault(ref MessageRpc rpc)
 {
     if (rpc.Error != null)
     {
         ProvideMessageFaultCore(ref rpc);
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:ErrorBehavior.cs


示例4: HandleErrorCore

 private void HandleErrorCore(ref MessageRpc rpc)
 {
     if (this.HandleErrorCommon(rpc.Error, ref rpc.FaultInfo))
     {
         rpc.Error = null;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ErrorBehavior.cs


示例5: HandleError

 internal void HandleError(ref MessageRpc rpc)
 {
     if (rpc.Error != null)
     {
         this.HandleErrorCore(ref rpc);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ErrorBehavior.cs


示例6: AddReference

 internal void AddReference(ref MessageRpc rpc, Transaction tx, bool updateCallCount)
 {
     lock (this.mutex)
     {
         if (this.pending == null)
         {
             this.pending = new Dictionary<Transaction, RemoveReferenceRM>();
         }
         if (tx != null)
         {
             RemoveReferenceRM erm;
             if (this.pending == null)
             {
                 this.pending = new Dictionary<Transaction, RemoveReferenceRM>();
             }
             if (!this.pending.TryGetValue(tx, out erm))
             {
                 RemoveReferenceRM erm2 = new RemoveReferenceRM(this.instanceContext, tx, rpc.Operation.Name) {
                     CallCount = 1L
                 };
                 this.pending.Add(tx, erm2);
             }
             else if (updateCallCount)
             {
                 erm.CallCount += 1L;
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:TransactionInstanceContextFacet.cs


示例7: InitializeCallContext

 internal void InitializeCallContext(ref MessageRpc rpc)
 {
     if (rpc.Operation.TransactionRequired)
     {
         rpc.Transaction.ThreadEnter(ref rpc.Error);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:TransactionBehavior.cs


示例8: ClearCallContext

 internal void ClearCallContext(ref MessageRpc rpc)
 {
     if (rpc.Operation.TransactionRequired)
     {
         rpc.Transaction.ThreadLeave();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:TransactionBehavior.cs


示例9: ProvideMessageFaultCoreCoda

        void ProvideMessageFaultCoreCoda(ref MessageRpc rpc)
        {
            if (rpc.FaultInfo.Fault.Headers.Action == null)
            {
                rpc.FaultInfo.Fault.Headers.Action = rpc.RequestVersion.Addressing.DefaultFaultAction;
            }

            rpc.Reply = rpc.FaultInfo.Fault;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:9,代码来源:ErrorBehavior.cs


示例10: Complete

 public void Complete(ImmutableDispatchRuntime dispatchRuntime, ref MessageRpc rpc, TimeSpan timeout, Transaction transaction)
 {
     AcknowledgementCompleteCallbackState state = new AcknowledgementCompleteCallbackState {
         DispatchRuntime = dispatchRuntime,
         Rpc = rpc
     };
     IAsyncResult result = new AcknowledgementCompleteAsyncResult(this.receiveContext, timeout, ref rpc, transaction, handleEndComplete, state);
     if (result.CompletedSynchronously)
     {
         AcknowledgementCompleteAsyncResult.End(result);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ReceiveContextRPCFacet.cs


示例11: ProvideMessageFaultCore

        void ProvideMessageFaultCore(ref MessageRpc rpc)
        {
            if (this.messageVersion != rpc.RequestVersion)
            {
                Fx.Assert("System.ServiceModel.Dispatcher.ErrorBehavior.ProvideMessageFaultCore(): (this.messageVersion != rpc.RequestVersion)");
            }

            this.InitializeFault(ref rpc);

            this.ProvideFault(rpc.Error, rpc.Channel.GetProperty<FaultConverter>(), ref rpc.FaultInfo);

            this.ProvideMessageFaultCoreCoda(ref rpc);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:13,代码来源:ErrorBehavior.cs


示例12: InitializeFault

 void InitializeFault(ref MessageRpc rpc)
 {
     Exception error = rpc.Error;
     FaultException fault = error as FaultException;
     if (fault != null)
     {
         string action;
         MessageFault messageFault = rpc.Operation.FaultFormatter.Serialize(fault, out action);
         if (action == null)
             action = rpc.RequestVersion.Addressing.DefaultFaultAction;
         if (messageFault != null)
             rpc.FaultInfo.Fault = Message.CreateMessage(rpc.RequestVersion, messageFault, action);
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:14,代码来源:ErrorBehavior.cs


示例13: AfterReply

 internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
 {
     InstanceContext instanceContext = rpc.InstanceContext;
     if (instanceContext != null)
     {
         try
         {
             if (rpc.Operation.ReleaseInstanceAfterCall)
             {
                 if (instanceContext.State == CommunicationState.Opened)
                 {
                     instanceContext.ReleaseServiceInstance();
                 }
             }
             else if (((this.releaseServiceInstanceOnTransactionComplete && this.isSynchronized) && (rpc.transaction != null)) && (rpc.transaction.IsCompleted || (rpc.Error != null)))
             {
                 if (instanceContext.State == CommunicationState.Opened)
                 {
                     instanceContext.ReleaseServiceInstance();
                 }
                 if (DiagnosticUtility.ShouldTraceInformation)
                 {
                     TraceUtility.TraceEvent(TraceEventType.Information, 0xe000c, System.ServiceModel.SR.GetString("TraceCodeTxReleaseServiceInstanceOnCompletion", new object[] { "*" }));
                 }
             }
         }
         catch (Exception exception)
         {
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             error.HandleError(exception);
         }
         try
         {
             instanceContext.UnbindRpc(ref rpc);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             error.HandleError(exception2);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:48,代码来源:InstanceBehavior.cs


示例14: CreateIfRequired

        //Called from ProcessMessage1
        //ManualAcknowledgementMode : No-Op.
        //Non-transacted V1 Operation : Remove RC; RC.Complete;(Will pause RPC if truly async)
        //Else : Create and Attach RCFacet to MessageRPC.
        public static void CreateIfRequired(ImmutableDispatchRuntime dispatchRuntime, ref MessageRpc messageRpc)
        {
            if (messageRpc.Operation.ReceiveContextAcknowledgementMode == ReceiveContextAcknowledgementMode.ManualAcknowledgement)
            {
                //Manual mode, user owns the acknowledgement.
                return;
            }

            //Retrieve RC from request and ensure it is removed from Message.
            ReceiveContext receiveContext = null;
            if (!ReceiveContext.TryGet(messageRpc.Request, out receiveContext))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                    new InvalidOperationException(
                    SR.GetString(SR.SFxReceiveContextPropertyMissing,
                    typeof(ReceiveContext).Name)));
            }
            messageRpc.Request.Properties.Remove(ReceiveContext.Name);

            if (messageRpc.Operation.ReceiveContextAcknowledgementMode == ReceiveContextAcknowledgementMode.AutoAcknowledgeOnReceive)
            {
                if (!messageRpc.Operation.TransactionRequired)
                {
                    //Attempt to complete the ReceiveContext.
                    //Async Result Ensures RPC is paused if it goes ASYNC.
                    IAsyncResult result = new AcknowledgementCompleteAsyncResult(
                        receiveContext,
                        TimeSpan.MaxValue,
                        ref messageRpc,
                        null,
                        handleEndComplete,
                        new AcknowledgementCompleteCallbackState
                        {
                            DispatchRuntime = dispatchRuntime,
                            Rpc = messageRpc
                        });

                    if (result.CompletedSynchronously)
                    {
                        AcknowledgementCompleteAsyncResult.End(result);
                    }
                    return;
                }
            }
            //We have to create a Facet for acknowledgement at later stage.
            messageRpc.ReceiveContext = new ReceiveContextRPCFacet(receiveContext);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:51,代码来源:ReceiveContextRPCFacet.cs


示例15: AfterReply

        internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
        {
            InstanceContext context = rpc.InstanceContext;

            if (context != null)
            {
                try
                {
                    context.UnbindRpc(ref rpc);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }
            }
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:20,代码来源:InstanceBehavior.cs


示例16: Complete

        //Called from ProcessMessage31.
        //Mode is TransactedOperation && !ManualAcknowledgement
        //Will pause RPC if Complete is truly Async.
        public void Complete(ImmutableDispatchRuntime dispatchRuntime, ref MessageRpc rpc, TimeSpan timeout, Transaction transaction)
        {
            Fx.Assert(transaction != null, "Cannot reach here with null transaction");
            //Async Result Ensures the RPC is paused if the request goes Async.
            IAsyncResult result = new AcknowledgementCompleteAsyncResult(
                this.receiveContext,
                timeout,
                ref rpc,
                transaction,
                handleEndComplete,
                new AcknowledgementCompleteCallbackState
                {
                    DispatchRuntime = dispatchRuntime,
                    Rpc = rpc
                });

            if (result.CompletedSynchronously)
            {
                AcknowledgementCompleteAsyncResult.End(result);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:24,代码来源:ReceiveContextRPCFacet.cs


示例17: EnsureInstanceContext

        internal void EnsureInstanceContext(ref MessageRpc rpc)
        {
            if (rpc.InstanceContext == null)
            {
                throw new ArgumentNullException("rpc.InstanceContext");
            }

            rpc.OperationContext.SetInstanceContext(rpc.InstanceContext);
            rpc.InstanceContext.Behavior = this;

            if (rpc.InstanceContext.State == CommunicationState.Created)
            {
                lock (rpc.InstanceContext.ThisLock)
                {
                    if (rpc.InstanceContext.State == CommunicationState.Created)
                    {
                        rpc.InstanceContext.Open(rpc.Channel.CloseTimeout);
                    }
                }
            }
            rpc.InstanceContext.BindRpc(ref rpc);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:22,代码来源:InstanceBehavior.cs


示例18: BindCore

 private void BindCore(ref MessageRpc rpc, bool startOperation)
 {
     SynchronizationContext syncContext = this.GetSyncContext(rpc.InstanceContext);
     if (syncContext != null)
     {
         IResumeMessageRpc state = rpc.Pause();
         if (startOperation)
         {
             syncContext.OperationStarted();
             syncContext.Post(this.ThreadAffinityStartCallbackDelegate, state);
         }
         else
         {
             syncContext.Post(this.ThreadAffinityEndCallbackDelegate, state);
         }
     }
     else if (rpc.SwitchedThreads)
     {
         IResumeMessageRpc rpc3 = rpc.Pause();
         ActionItem.Schedule(CleanThreadCallbackDelegate, rpc3);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:ThreadBehavior.cs


示例19: GetAndCacheSecurityContext

 private ServiceSecurityContext GetAndCacheSecurityContext(ref MessageRpc rpc)
 {
     ServiceSecurityContext securityContext = rpc.SecurityContext;
     if (!rpc.HasSecurityContext)
     {
         SecurityMessageProperty security = rpc.Request.Properties.Security;
         if (security == null)
         {
             securityContext = null;
         }
         else
         {
             securityContext = security.ServiceSecurityContext;
             if (securityContext == null)
             {
                 throw TraceUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SecurityContextMissing", new object[] { rpc.Operation.Name })), rpc.Request);
             }
         }
         rpc.SecurityContext = securityContext;
         rpc.HasSecurityContext = true;
     }
     return securityContext;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:SecurityImpersonationBehavior.cs


示例20: LockInstance

 internal void LockInstance(ref MessageRpc rpc)
 {
     if (this.mode != ConcurrencyMode.Multiple)
     {
         ConcurrencyInstanceContextFacet concurrency = rpc.InstanceContext.Concurrency;
         lock (rpc.InstanceContext.ThisLock)
         {
             if (!concurrency.Locked)
             {
                 concurrency.Locked = true;
             }
             else
             {
                 MessageRpcWaiter waiter = new MessageRpcWaiter(rpc.Pause());
                 concurrency.EnqueueNewMessage(waiter);
             }
         }
         if (this.mode == ConcurrencyMode.Reentrant)
         {
             rpc.OperationContext.IsServiceReentrant = true;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:ConcurrencyBehavior.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Dispatcher.Opcode类代码示例发布时间:2022-05-26
下一篇:
C# Dispatcher.EndpointDispatcher类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap