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

C# IClientChannel类代码示例

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

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



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

示例1: BeginDisplayInitializationUI

		public IAsyncResult BeginDisplayInitializationUI (
			IClientChannel channel,
			AsyncCallback callback,
			object state)
		{
			throw new NotImplementedException ();
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:InfocardInteractiveChannelInitializer.cs


示例2: PokerServer

 public PokerServer(ICommandBus cmdBus, ITableProjection tableProjection, IPlayerConnectionMap playerConnectionMap, IClientChannel clientChannel)
 {
     _cmdBus = cmdBus;
     _tables = tableProjection;
     _playerConnectionMap = playerConnectionMap;
     _clientChannel = clientChannel;
 }
开发者ID:pdoh00,项目名称:card-game-framework,代码行数:7,代码来源:PokerServer.cs


示例3: BeforeSendRequest

        /// <summary>
        /// Add token message at header to using NHibernate cache
        /// </summary>
        /// <param name="request"></param>
        /// <param name="channel"></param>
        /// <returns></returns>
        public object BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            // add trace log for debug and performance tuning
            if (null != (request.Headers).MessageId && (request.Headers).MessageId.IsGuid)
            {
                ServiceStopWatch = Stopwatch.StartNew();
                Guid messageId;
                (request.Headers).MessageId.TryGetGuid(out messageId);

                CurrentTraceInfo = new TraceInfo()
                {
                    SessionId = (HttpContext.Current != null && HttpContext.Current.Session != null) ? HttpContext.Current.Session.SessionID : "",
                    TraceType = TraceType.WcfActionClientCall,
                    TraceName = request.Headers.Action,
                    TraceUniqueId = messageId.ToString()
                };

                TraceLogger.Instance.TraceServiceStart(CurrentTraceInfo, true);

                // Add a message header with sessionid
                MessageHeader<string> messageHeader = new MessageHeader<string>(CurrentTraceInfo.SessionId);
                MessageHeader untyped = messageHeader.GetUntypedHeader("sessionid", "ns");
                request.Headers.Add(untyped);
            }
            return null;
        }
开发者ID:VKeCRM,项目名称:V2,代码行数:32,代码来源:TraceClientMessageInspector.cs


示例4: ConversationViewModel

 public ConversationViewModel(IClientChannel clientChannel,
                              IForegroundUpdateService foregroundUpdateService,
                              IVoipChannel voipChannel)
 {
     _clientChannel = clientChannel;
     _voipChannel = voipChannel;
     _foregroundUpdateService = foregroundUpdateService;
     foregroundUpdateService.OnRelayMessagesUpdated += OnRelayMessagesUpdated;
     foregroundUpdateService.OnVoipStateUpdate += OnVoipStateUpdate;
     foregroundUpdateService.OnFrameFormatUpdate += OnFrameFormatUpdate;
     foregroundUpdateService.OnFrameRateUpdate += OnFrameRateUpdate;
     SendInstantMessageCommand = new DelegateCommand(OnSendInstantMessageCommandExecute,
         OnSendInstantMessageCommandCanExecute);
     AudioCallCommand = new DelegateCommand(OnCallCommandExecute, OnCallCommandCanExecute);
     VideoCallCommand = new DelegateCommand(OnVideoCallCommandExecute, OnVideoCallCommandCanExecute);
     HangupCommand = new DelegateCommand(OnHangupCommandExecute, OnHangupCommandCanExecute);
     AnswerCommand = new DelegateCommand(OnAnswerCommandExecute, OnAnswerCommandCanExecute);
     RejectCommand = new DelegateCommand(OnRejectCommandExecute, OnRejectCommandCanExecute);
     CloseConversationCommand = new DelegateCommand(OnCloseConversationCommandExecute, () => _canCloseConversation);
     MuteMicrophoneCommand = new DelegateCommand(MuteMicCommandExecute, MicCommandCanExecute);
     UnMuteMicrophoneCommand = new DelegateCommand(UnMuteCommandExecute, MicCommandCanExecute);
     SwitchVideoCommand = new DelegateCommand(SwitchVideoCommandExecute, SwitchVideoCommandCanExecute);
     LayoutService.Instance.LayoutChanged += LayoutChanged;
     LayoutChanged(LayoutService.Instance.LayoutType);
     SetVideoPresenters();
 }
开发者ID:openpeer,项目名称:ChatterBox,代码行数:26,代码来源:ConversationViewModel.cs


示例5: BeforeSendRequest

		public object BeforeSendRequest(ref Message request, IClientChannel channel)
		{
			var tokenInjector = ServiceLocator.Current.GetInstance<ISecurityTokenInjector>();

			if (tokenInjector != null)
			{
				object httpRequestMessageObject;

				if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out httpRequestMessageObject))
				{
					var httpRequestMessage = httpRequestMessageObject as HttpRequestMessageProperty;

					if (httpRequestMessage != null)
						tokenInjector.InjectToken(httpRequestMessage.Headers);
				}
				else
				{
					var httpRequestMessage = new HttpRequestMessageProperty();
					tokenInjector.InjectToken(httpRequestMessage.Headers);
					request.Properties.Add(HttpRequestMessageProperty.Name, httpRequestMessage);
				}
			}

			return null;
		}
开发者ID:gitter-badger,项目名称:vc-community-1.x,代码行数:25,代码来源:SecurityTokenEndpointBehavior.cs


示例6: BeforeSendRequest

 public object BeforeSendRequest(ref Message request, IClientChannel channel)
 {
     MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue);
     request = buffer.CreateMessage();
     Console.WriteLine("Sending:\n{0}", buffer.CreateMessage().ToString());
     return request;
 }
开发者ID:gitlabuser,项目名称:warehouse,代码行数:7,代码来源:ConsoleOutputBehavior.cs


示例7: GetRemoteHostService

        /// <summary>
        /// Gets a remote host service using the specified channel.
        /// </summary>
        /// <param name="channel">The channel.</param>
        /// <returns>The remote host service.</returns>
        public static IRemoteHostService GetRemoteHostService(IClientChannel channel)
        {
            if (channel == null)
                throw new ArgumentNullException("channel");

            return (IRemoteHostService)channel.GetService(typeof(IRemoteHostService), ServiceName);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:HostServiceChannelInterop.cs


示例8: BeforeSendRequest

        public object BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            if (!request.IsEmpty)
            {
                XmlReader bodyReader = request.GetReaderAtBodyContents().ReadSubtree();

                MemoryStream stream = new MemoryStream();
                XmlWriter writer = XmlWriter.Create(stream);

                if (transform == null)
                {
                    transform = new XslCompiledTransform(true);
                    var reader = XmlReader.Create(new StringReader(Properties.Resources.XmlCleaner));
                    transform.Load(reader);
                }
                transform.Transform(bodyReader, writer);

                stream.Flush();
                stream.Seek(0, SeekOrigin.Begin);

                bodyReader = XmlReader.Create(stream);

                Message changedMessage = Message.CreateMessage(request.Version, null, bodyReader);
                changedMessage.Headers.CopyHeadersFrom(request.Headers);
                changedMessage.Properties.CopyProperties(request.Properties);
                request = changedMessage;
            }

            return null;
        }
开发者ID:spardo,项目名称:dotnet37signals,代码行数:30,代码来源:RestClientMessageInspector.cs


示例9: AfterReceiveRequest

        public object AfterReceiveRequest(ref Message request,
		                                  IClientChannel channel,
		                                  InstanceContext instanceContext)
        {
            OperationContext.Current.Extensions.Add(new WorkerContext());
            return request.Headers.MessageId;
        }
开发者ID:GulinSS,项目名称:LargePrimes-Sample,代码行数:7,代码来源:WorkerContextMessageInspector.cs


示例10: AfterReceiveRequest

        public object AfterReceiveRequest(ref Message request,
               IClientChannel channel,
               InstanceContext instanceContext)
        {
            // Extract Cookie (name=value) from messageproperty
            var messageProperty = (HttpRequestMessageProperty)
                OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name];
            string cookie = messageProperty.Headers.Get("Set-Cookie");
            if (string.IsNullOrWhiteSpace(cookie))
                return null;

            string[] nameValue = cookie.Split('=', ',');
            string userName = string.Empty;

            // Set User Name from cookie
            int pos = nameValue.ToList().IndexOf(".ASPXAUTH");
            if (pos == -1)
                return null;

            userName = nameValue[pos + 1];

            // Set Thread Principal to User Name
            EnterpriseIdentity enterpriseIdentity = new EnterpriseIdentity();
            GenericPrincipal threadCurrentPrincipal =
                   new GenericPrincipal(enterpriseIdentity, new string[] { });
            enterpriseIdentity.IsAuthenticated = true;
            enterpriseIdentity.Name = userName;
            System.Threading.Thread.CurrentPrincipal = threadCurrentPrincipal;

            return null;
        }
开发者ID:asdlvs,项目名称:MinStat,代码行数:31,代码来源:IdentityMessageInspector.cs


示例11: BeforeSendRequest

        public object BeforeSendRequest(ref Message request, IClientChannel channel)
        {
            var header = MessageHeader.CreateHeader(Constants.ProtocolVersion, Constants.Namespace, Constants.SupportedProtocolVersion);
            request.Headers.Add(header);

            return null;
        }
开发者ID:nothrow,项目名称:OrionSDK,代码行数:7,代码来源:SwisProtocolVersionMessageInspector.cs


示例12: AfterReceiveRequest

 public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel, InstanceContext instanceContext)
 {
     /* Add request Logging code here
      *  Message contents in request.ToString()
      */
     return null;
 }
开发者ID:gavdraper,项目名称:WCFMessageLogging,代码行数:7,代码来源:Inspector.cs


示例13: AfterReceiveRequest

 public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
 {
     var logger = ObjectFactory.GetInstance<ILogger>();
     logger.StartAction(request.Headers.To.ToString());
     logger.Write("Incoming Message", request.ToString());
     return null;
 }
开发者ID:josh28,项目名称:TaskMaster,代码行数:7,代码来源:CustomMessageInspector.cs


示例14: BeforeSendRequest

 public object BeforeSendRequest(ref Message request, IClientChannel channel)
 {
     object httpRequestMessageObject;
     if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out httpRequestMessageObject))
     {
         HttpRequestMessageProperty httpRequestMessage = httpRequestMessageObject as HttpRequestMessageProperty;
         if (httpRequestMessage != null)
         {
             httpRequestMessage.Headers[SERVICE_KEY_HTTP_HEADER] = (ServiceKey ?? string.Empty);
         }
         else
         {
             httpRequestMessage = new HttpRequestMessageProperty();
             httpRequestMessage.Headers.Add(SERVICE_KEY_HTTP_HEADER, (ServiceKey ?? string.Empty));
             request.Properties[HttpRequestMessageProperty.Name] = httpRequestMessage;
         }
     }
     else
     {
         HttpRequestMessageProperty httpRequestMessage = new HttpRequestMessageProperty();
         httpRequestMessage.Headers.Add(SERVICE_KEY_HTTP_HEADER, (ServiceKey ?? string.Empty));
         request.Properties.Add(HttpRequestMessageProperty.Name, httpRequestMessage);
     }
     return null;
 }
开发者ID:pouc,项目名称:qv-extensions,代码行数:25,代码来源:ServiceKeyClientMessageInspector.cs


示例15: AfterReceiveRequest

        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            if (!request.IsFault && !request.IsEmpty)
                LogRequest(ref request);

            return null;
        }
开发者ID:amoraller,项目名称:AptekaAutoOrder,代码行数:7,代码来源:Interceptor.cs


示例16: BeforeSendRequest

 /// <summary>Enables inspection or modification of a message before a request message is sent to a service.</summary>
 /// <param name="request">The message to be sent to the service.</param>
 /// <param name="channel">The  client object channel.</param>
 /// <returns>
 /// The object that is returned as the <c>correlationState</c> argument of the <see cref="M:System.ServiceModel.Dispatcher.IClientMessageInspector.AfterReceiveReply([email protected],System.Object)"/> method. This is null if no correlation state is used.The best practice is to make this a <see cref="T:System.Guid"/> to ensure that no two <c>correlationState</c> objects are the same.
 /// </returns>
 public object BeforeSendRequest( ref Message request, IClientChannel channel )
 {
     var correlationState = Guid.NewGuid();
     this._logger.Trace( @"Request {{{0}}}:
     {1}", correlationState.ToString(), request.ToString() );
     return correlationState;
 }
开发者ID:slav,项目名称:Netco,代码行数:13,代码来源:LoggingInspector.cs


示例17: AfterReceiveRequest

        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            if (request.Properties.ContainsKey("UriTemplateMatchResults"))
            {
                HttpRequestMessageProperty httpmsg = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];
                UriTemplateMatch match = (UriTemplateMatch)request.Properties["UriTemplateMatchResults"];

                string format = match.QueryParameters["$format"];
                if ("json".Equals(format, StringComparison.InvariantCultureIgnoreCase))
                {
                    // strip out $format from the query options to avoid an error
                    // due to use of a reserved option (starts with "$")
                    match.QueryParameters.Remove("$format");

                    // replace the Accept header so that the Data Services runtime 
                    // assumes the client asked for a JSON representation
                    httpmsg.Headers["Accept"] = "application/json, text/plain;q=0.5";
                    httpmsg.Headers["Accept-Charset"] = "utf-8";

                    string callback = match.QueryParameters["$callback"];
                    if (!string.IsNullOrEmpty(callback))
                    {
                        match.QueryParameters.Remove("$callback");
                        return callback;
                    }
                }
            }

            return null;
        }
开发者ID:gabla5,项目名称:LearningProjects,代码行数:30,代码来源:JsonPSupportBehaviorAttribute.cs


示例18: AfterReceiveRequest

        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            var httpRequest = request.Properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
            var authorizationHeader = httpRequest.Headers["Authorization"];

            if (string.IsNullOrEmpty(authorizationHeader))
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }

            string user;
            string password;

            this.ParseUserPasswordFromHeader(authorizationHeader, out user, out password);

            if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(password))
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }

            var authenticationService = ObjectFactory.GetInstance<IAuthenticationService>();

            if (!authenticationService.Authenticate(user, password))
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }

            return instanceContext;
        }
开发者ID:luismdcp,项目名称:PROMPT-06-Services,代码行数:29,代码来源:AuthenticationHeaderInspector.cs


示例19: RosterViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="RosterViewModel"/> class.
        /// </summary>
        /// <param name="clientChannel">The client channel.</param>
        public RosterViewModel(IClientChannel clientChannel, LoginViewModel loginViewModel)
            : this()
        {
            if (clientChannel == null)
            {
                throw new ArgumentNullException("clientChannel");
            }

            if (clientChannel.State != SessionState.Established)
            {
                throw new ArgumentException("The session is in an invalid state");
            }

            _clientChannel = clientChannel;
            this.Identity = _clientChannel.LocalNode.ToIdentity();
            
            if (loginViewModel == null)
            {
                throw new ArgumentNullException("loginViewModel");
            }

            _loginViewModel = loginViewModel;

            _cancellationTokenSource = new CancellationTokenSource();
            _listenerTask = ListenAsync();

        }
开发者ID:guitcastro,项目名称:lime,代码行数:31,代码来源:RosterViewModel.cs


示例20: BeforeSendRequest

 public object BeforeSendRequest(
     ref Message request, 
     IClientChannel channel)
 {
     reqPayload = request.ToString();
     return null;
 }
开发者ID:oo00spy00oo,项目名称:Accelerators,代码行数:7,代码来源:MyEndpointBehavior.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IClientChannelSinkProvider类代码示例发布时间:2022-05-24
下一篇:
C# IClientAPI类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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