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


C# IHubIncomingInvokerContext类代码示例

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


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

示例1: OnIncomingError

        protected override void OnIncomingError(ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext)
        {
            Console.WriteLine(exceptionContext.Error);

            //exceptionContext.Result = "Change the return value, nulls error";
            base.OnIncomingError(exceptionContext, invokerContext);
        }
开发者ID:JordanZaerr,项目名称:ChatRoom,代码行数:7,代码来源:ErrorModule.cs

示例2: OnBeforeIncoming

 /// <summary>
 /// 数据传到Hub之前进行数据解密
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 protected override bool OnBeforeIncoming(IHubIncomingInvokerContext context)
 {
     //_canCrypto = CanCrypto(context.Hub.Context);
     //if (!_canCrypto)
     //{
     //    return base.OnBeforeIncoming(context);
     //}
     //数据解密
     string facePublicKey = context.Hub.Context.Headers.Get(HttpHeaderNames.OSharpClientPublicKey);
     if (string.IsNullOrEmpty(facePublicKey))
     {
         return false;
     }
     _cryptor = new CommunicationCryptor(_ownPrivateKey, facePublicKey, _hashType);
     if (context.Args.Count == 1)
     {
         string encrypt = (string)context.Args[0];
         string json = _cryptor.DecryptAndVerifyData(encrypt);
         IList<object> args = JsonConvert.DeserializeObject<IList<object>>(json);
         context.Args.Clear();
         IList<object> values = context.MethodDescriptor.Parameters.Zip(args, (desc, arg) => ResolveParameter(desc, arg)).ToList();
         foreach (object arg in values)
         {
             context.Args.Add(arg);
         }
     }
     return base.OnBeforeIncoming(context);
 }
开发者ID:yonghu86,项目名称:osharp,代码行数:33,代码来源:HostCryptoHubPipelineModule.cs

示例3: AuthorizeHubMethodInvocation

        public override bool AuthorizeHubMethodInvocation(IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
        {
            if (string.IsNullOrWhiteSpace(AuthToken))
                return false;

            return hubIncomingInvokerContext.Hub.Context.Headers[AuthTokenProvider.AuthTokenKey] == AuthToken;
        }
开发者ID:GDownes,项目名称:ReactiveTrader,代码行数:7,代码来源:ControlAuth.cs

示例4: OnAfterIncoming

        protected override object OnAfterIncoming(object result, IHubIncomingInvokerContext context)
        {
            var startedOn = (DateTime)context.StateTracker["ProfilingHubPipelineModule-Invocation-StartedOn"];
            var invocation = new InvocationModel
            {
                ConnectionId = context.Hub.Context.ConnectionId,
                Hub = context.MethodDescriptor.Hub.Name,
                Method = context.MethodDescriptor.Name,
                StartedOn = startedOn,
                EndedOn = DateTime.Now,
                Result = new InvocationResultModel
                    {
                        Value = result,
                        Type = context.MethodDescriptor.ReturnType
                    },
                Arguments = context.Args.Count > 0 ? context.Args
                    .Select((t, i) => new InvocationArgumentModel
                    {
                        Value = t,
                        Name = context.MethodDescriptor.Parameters[i].Name,
                        Type = context.MethodDescriptor.Parameters[i].ParameterType
                    })
                    .ToList() : null
            };

            PluginSettings.StoreInvocation(invocation);
            return base.OnAfterIncoming(result, context);
        }
开发者ID:stevenlauwers22,项目名称:Glimpse.SignalR,代码行数:28,代码来源:ProfilerHubPipelineModule.cs

示例5: OnBeforeIncoming

 protected override bool OnBeforeIncoming(IHubIncomingInvokerContext context)
 {
     #if DEBUG
     Debug.WriteLine("=> Invoking " + context.MethodDescriptor.Name + " on hub " + context.MethodDescriptor.Hub.Name);
     #endif
     return base.OnBeforeIncoming(context);
 }
开发者ID:OleksandrKulchytskyi,项目名称:Sharedeployed,代码行数:7,代码来源:LoggingPipelineModule.cs

示例6: OnIncomingError

 protected override void OnIncomingError(ExceptionContext exceptionContext, IHubIncomingInvokerContext context)
 {
     if (log.IsErrorEnabled)
     {
         log.ErrorFormat("Exception while invoking {0} on hub {1}: {2}", context.MethodDescriptor.Name, context.MethodDescriptor.Hub.Name, exceptionContext.Error.Message);
     }
     base.OnIncomingError(exceptionContext, context);
 }
开发者ID:alana1,项目名称:NancySamples,代码行数:8,代码来源:LoggingHubPipelineModule.cs

示例7: OnBeforeIncoming

 protected override bool OnBeforeIncoming(IHubIncomingInvokerContext context)
 {
     if (log.IsDebugEnabled)
     {
         log.DebugFormat(string.Format("Invoking {0} on hub {1}", context.MethodDescriptor.Name, context.MethodDescriptor.Hub.Name));
     }
     return base.OnBeforeIncoming(context);
 }
开发者ID:alana1,项目名称:NancySamples,代码行数:8,代码来源:LoggingHubPipelineModule.cs

示例8: OnBeforeIncoming

 protected override bool OnBeforeIncoming(IHubIncomingInvokerContext context)
 {
     if (Log.IsDebugEnabled)
     {
         Log.DebugFormat("=> Invoking " + context.MethodDescriptor.Name + " on hub " + context.MethodDescriptor.Hub.Name);
     }
     return base.OnBeforeIncoming(context);
 }
开发者ID:925coder,项目名称:ReactiveTrader,代码行数:8,代码来源:LoggingPipelineModule.cs

示例9: OnIncomingError

 protected override void OnIncomingError(ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext)
 {
     Debug.WriteLine("=> Exception " + exceptionContext.Error.Message);
     if (exceptionContext.Error.InnerException != null)
     {
         Debug.WriteLine("=> Inner Exception " + exceptionContext.Error.InnerException.Message);
     }
     base.OnIncomingError(exceptionContext, invokerContext);
 }
开发者ID:kjorlaug,项目名称:KjeringiOpen,代码行数:9,代码来源:Startup.cs

示例10: OnIncomingError

 protected override void OnIncomingError(ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext)
 {
     ChatLog.Debug("=> Exception " + exceptionContext.Error.Message + " " + exceptionContext.Error.StackTrace);
     if (exceptionContext.Error.InnerException != null)
     {
         ChatLog.Debug("=> Inner Exception " + exceptionContext.Error.InnerException.Message + " " + exceptionContext.Error.InnerException.StackTrace);
     }
     base.OnIncomingError(exceptionContext, invokerContext);
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:9,代码来源:ErrorHandlingPipelineModule.cs

示例11: OnIncomingError

 protected override void OnIncomingError(ExceptionContext ex, IHubIncomingInvokerContext context)
 {
     _slabLogger.Log(HubType.HubServerVerbose, "=> Exception " + ex.Error + " " + ex.Result);
     if (ex.Error.InnerException != null)
     {
         _slabLogger.Log(HubType.HubServerVerbose, "=> Inner Exception " + ex.Error.InnerException.Message);
     }
     base.OnIncomingError(ex, context);
 }
开发者ID:llenroc,项目名称:SignalRMessagingErrorHandling,代码行数:9,代码来源:ErrorHandlingPipelineModule.cs

示例12: OnIncomingError

 protected override void OnIncomingError(ExceptionContext exceptionContext, IHubIncomingInvokerContext invokerContext) {
     _logger.Error()
         .Exception(exceptionContext.Error)
         .MarkUnhandled("ErrorHandlingPipelineModule")
         .Message("Unhandled: {0}", exceptionContext.Error.Message)
         .Tag("SignalR")
         .Write();
     
     base.OnIncomingError(exceptionContext, invokerContext);
 }
开发者ID:rpotalara,项目名称:Exceptionless,代码行数:10,代码来源:ErrorHandlingPipelineModule.cs

示例13: OnBeforeIncoming

        protected override bool OnBeforeIncoming(IHubIncomingInvokerContext context)
        {
            var id = HttpContext.Current.User.Identity.IsAuthenticated
                ? "fred"
                : string.Empty;

            context.Hub.Groups.Add(context.Hub.Context.ConnectionId, id);

            return base.OnBeforeIncoming(context);
        }
开发者ID:jchannon,项目名称:SignalRMVC3Test,代码行数:10,代码来源:AuthenticationHubPipelineModule.cs

示例14: AuthorizeHubMethodInvocation

        public override bool AuthorizeHubMethodInvocation(IHubIncomingInvokerContext hubIncomingInvokerContext, bool appliesToMethod)
        {
            var connectionId = hubIncomingInvokerContext.Hub.Context.ConnectionId;
            var environment = hubIncomingInvokerContext.Hub.Context.Request.Environment;
            var principal = hubIncomingInvokerContext.Hub.Context.Request.Environment["server.User"] as IPrincipal;

            if (principal == null || !principal.Identity.IsAuthenticated) return false;
            hubIncomingInvokerContext.Hub.Context = new HubCallerContext(new ServerRequest(environment), connectionId);
            return true;
        }
开发者ID:TNOCS,项目名称:csTouch,代码行数:10,代码来源:BasicAuthenticationAttribute.cs

示例15: AuthorizeHubMethodInvocation

 public bool AuthorizeHubMethodInvocation(IHubIncomingInvokerContext hubIncomingInvokerContext)
 {
     switch (Mode)
     {
         case AuthorizeMode.Both:
         case AuthorizeMode.Incoming:
             return UserAuthorized(hubIncomingInvokerContext.Hub.Context.User);
         default:
             Debug.Assert(Mode == AuthorizeMode.Outgoing); // Guard in case new values are added to the enum
             return true;
     }
 }
开发者ID:aceslick911,项目名称:SignalRTutorial,代码行数:12,代码来源:AuthorizeAttribute.cs


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