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

C# Dispatcher.EndpointDispatcher类代码示例

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

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



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

示例1: EndpointDispatcher

        EndpointDispatcher(EndpointDispatcher baseEndpoint, IEnumerable<AddressHeader> headers)
        {
            EndpointAddressBuilder builder = new EndpointAddressBuilder(baseEndpoint.EndpointAddress);
            foreach (AddressHeader h in headers)
            {
                builder.Headers.Add(h);
            }
            EndpointAddress address = builder.ToEndpointAddress();

            this.addressFilter = new EndpointAddressMessageFilter(address);
            // channelDispatcher is Attached
            this.contractFilter = baseEndpoint.ContractFilter;
            this.contractName = baseEndpoint.ContractName;
            this.contractNamespace = baseEndpoint.ContractNamespace;
            this.dispatchRuntime = baseEndpoint.DispatchRuntime;
            // endpointFilter is lazy
            this.filterPriority = baseEndpoint.FilterPriority + 1;
            this.originalAddress = address;
            if (PerformanceCounters.PerformanceCountersEnabled)
            {
                this.perfCounterId = baseEndpoint.perfCounterId;
                this.perfCounterBaseId = baseEndpoint.perfCounterBaseId;
            }
            this.id = baseEndpoint.id;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:EndpointDispatcher.cs


示例2: AddEndpoint

 public void AddEndpoint(EndpointDispatcher endpoint)
 {
     lock (this.ThisLock)
     {
         MessageFilter endpointFilter = endpoint.EndpointFilter;
         int filterPriority = endpoint.FilterPriority;
         if (this.filters == null)
         {
             if (this.cachedEndpoints == null)
             {
                 this.cachedEndpoints = new List<EndpointDispatcher>(2);
             }
             if (this.cachedEndpoints.Count < 2)
             {
                 this.cachedEndpoints.Add(endpoint);
             }
             else
             {
                 this.filters = new MessageFilterTable<EndpointDispatcher>();
                 for (int i = 0; i < this.cachedEndpoints.Count; i++)
                 {
                     int priority = this.cachedEndpoints[i].FilterPriority;
                     MessageFilter filter = this.cachedEndpoints[i].EndpointFilter;
                     this.filters.Add(filter, this.cachedEndpoints[i], priority);
                 }
                 this.filters.Add(endpointFilter, endpoint, filterPriority);
                 this.cachedEndpoints = null;
             }
         }
         else
         {
             this.filters.Add(endpointFilter, endpoint, filterPriority);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:EndpointDispatcherTable.cs


示例3: XsdValidationInspector

 void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     WsdlExporter wsdlExporter = new WsdlExporter();
     wsdlExporter.ExportEndpoint(endpoint);
     endpointDispatcher.DispatchRuntime.MessageInspectors.Add(
         new XsdValidationInspector(wsdlExporter.GeneratedXmlSchemas));
 }
开发者ID:ssickles,项目名称:archive,代码行数:7,代码来源:XsdValidation.cs


示例4: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (var operation in endpoint.Contract.Operations)
     {
         DecorateFormatterBehavior(operation, endpointDispatcher.DispatchRuntime);
     }
 }
开发者ID:peterluo0822,项目名称:wcf-1,代码行数:7,代码来源:BinaryFormatterBehavior.cs


示例5: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint Endpoint, EndpointDispatcher EndpointDispatcher)
     {
     return;
     //EndpointDispatcher.DispatchRuntime.MessageInspectors.Add (new HeaderInsertClientMessageInspector ());
     //foreach (DispatchOperation op in EndpointDispatcher.DispatchRuntime.Operations)
     //    op.ParameterInspectors.Add (new HeaderInsertClientMessageInspector ());
     }
开发者ID:heinzsack,项目名称:DEV,代码行数:7,代码来源:HeaderInsertClientMessageInspector.cs


示例6: CreateHttpGetChannelDispatcher

        private static void CreateHttpGetChannelDispatcher(ServiceHostBase host, Uri listenUri, MetadataSet metadata)
        {
            //创建Binding
            TextMessageEncodingBindingElement messageEncodingElement = new TextMessageEncodingBindingElement() { MessageVersion = MessageVersion.None };
            HttpTransportBindingElement transportElement = new HttpTransportBindingElement();
            Utility.SetPropertyValue(transportElement, "Method", "GET");
            Binding binding = new CustomBinding(messageEncodingElement, transportElement);

            //创建ChannelListener
            IChannelListener listener = binding.BuildChannelListener<IReplyChannel>(listenUri, string.Empty, ListenUriMode.Explicit, new BindingParameterCollection());
            ChannelDispatcher dispatcher = new ChannelDispatcher(listener, "ServiceMetadataBehaviorHttpGetBinding", binding) { MessageVersion = binding.MessageVersion };

            //创建EndpointDispatcher
            EndpointDispatcher endpoint = new EndpointDispatcher(new EndpointAddress(listenUri), "IHttpGetMetadata", "http://www.artech.com/");

            //创建DispatchOperation,并设置DispatchMessageFormatter和OperationInvoker
            DispatchOperation operation = new DispatchOperation(endpoint.DispatchRuntime, "Get", "*", "*");
            operation.Formatter = Utility.CreateInstance<IDispatchMessageFormatter>(MessageOperationFormatterType, Type.EmptyTypes, new object[0]);
            MethodInfo method = typeof(IHttpGetMetadata).GetMethod("Get");
            operation.Invoker = Utility.CreateInstance<IOperationInvoker>(SyncMethodInvokerType, new Type[] { typeof(MethodInfo) }, new object[] { method });
            endpoint.DispatchRuntime.Operations.Add(operation);

            //设置SingletonInstanceContext和InstanceContextProvider
            MetadataProvisionService serviceInstance = new MetadataProvisionService(metadata);
            endpoint.DispatchRuntime.SingletonInstanceContext = new InstanceContext(host, serviceInstance);
            endpoint.DispatchRuntime.InstanceContextProvider = Utility.CreateInstance<IInstanceContextProvider>(SingletonInstanceContextProviderType, new Type[] { typeof(DispatchRuntime) }, new object[] { endpoint.DispatchRuntime });
            dispatcher.Endpoints.Add(endpoint);

            //设置ContractFilter和AddressFilter
            endpoint.ContractFilter = new MatchAllMessageFilter();
            endpoint.AddressFilter = new MatchAllMessageFilter();

            host.ChannelDispatchers.Add(dispatcher);
        }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:34,代码来源:ServiceMetadataBehaviorAttribute.cs


示例7: ArgumentNullException

        void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher)
        {
            if (endpointDispatcher == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("endpointDispatcher"));

            endpointDispatcher.DispatchRuntime.ValidateMustUnderstand = this.ValidateMustUnderstand;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:MustUnderstandBehavior.cs


示例8: ApplyDispatchBehavior

		public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
		{
			foreach (DispatchOperation operation in endpointDispatcher.DispatchRuntime.Operations)
			{
				operation.CallContextInitializers.Add(new UnitOfWorkCallContextInitializer());
			}
		}
开发者ID:ramonsmits,项目名称:Castle.Facilities.Wcf,代码行数:7,代码来源:UnitOfworkEndPointBehavior.cs


示例9: ApplyDispatchBehavior

 /// <summary>
 ///     This service modify or extend the service across an endpoint.
 /// </summary>
 /// <param name="endpoint">The endpoint that exposes the contract.</param>
 /// <param name="endpointDispatcher">
 ///     The endpoint dispatcher to be
 ///     modified or extended.
 /// </param>
 public void ApplyDispatchBehavior(ServiceEndpoint endpoint,
     EndpointDispatcher endpointDispatcher)
 {
     // add inspector which detects cross origin requests
     endpointDispatcher.DispatchRuntime.MessageInspectors.Add(
         new MessageInspector(endpoint));
 }
开发者ID:djromix,项目名称:Portal.WorckFlow,代码行数:15,代码来源:BehaviorAttribute.cs


示例10: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
        {
            var protoBinding = endpoint.Binding as ProtoBufBinding;

            if (protoBinding == null)
                throw new ConfigurationException("The endpoint behaviour, ProtoBufBindingEndpointBehaviour, can only be applied to an endpoint which has ProtoBufBinding as its binding.");

            foreach (var operation in endpointDispatcher.DispatchRuntime.Operations)
            {
                var compressionBehaviour = protoBinding.GetOperationCompressionBehaviour(operation.Name);

                var contractInfo = ContractInfo.FromAction(operation.Action);

                var serviceContract = TypeFinder.FindServiceContract(contractInfo.ServiceContractName);

                var paramTypes = TypeFinder.GetContractParamTypes(serviceContract, contractInfo.OperationContractName,
                                                                  contractInfo.Action, false);

                var formatter = new ProtoBufDispatchFormatter(new List<TypeInfo>(paramTypes), contractInfo.Action, 
                    compressionBehaviour);

                operation.Formatter = formatter;
                operation.DeserializeRequest = true;
                operation.SerializeReply = true;
            }
        }
开发者ID:yonglehou,项目名称:ProtoBuf.Wcf,代码行数:26,代码来源:ProtoBufBindingEndpointBehaviour.cs


示例11: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (var item in endpointDispatcher.DispatchRuntime.Operations)
     {
         item.CallContextInitializers.Add(new CultureSettingCallContextInitializer());
     }
 }
开发者ID:0811112150,项目名称:HappyDayHistory,代码行数:7,代码来源:CultureSettingBehavior.cs


示例12: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (var op in endpoint.Contract.Operations)
     {
         op.Behaviors.Add(this);
     }
 }
开发者ID:radius314,项目名称:wcfrest,代码行数:7,代码来源:WCFSerialCachingBehavior.cs


示例13: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (DispatchOperation operation in endpointDispatcher.DispatchRuntime.Operations)
     {
         operation.ParameterInspectors.Add(new ConsumerInspector());
     }
 }
开发者ID:jpsfs,项目名称:feup-tdin-wcf_silverlight,代码行数:7,代码来源:ConsumerEndpointBehavior.cs


示例14: ApplyDispatchBehavior

		public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
		{
			foreach (var errorHandler in errorHandlers)
			{
				endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(errorHandler);
			}
		}
开发者ID:dohansen,项目名称:Windsor,代码行数:7,代码来源:WcfErrorBehavior.cs


示例15: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher)
        {
            if (serviceEndpoint == null)
                throw new ArgumentNullException("serviceEndpoint");

            if (endpointDispatcher == null)
                throw new ArgumentNullException("endpointDispatcher");

            // Apply URI-based operation selector
            Dictionary<string, string> operationNameDictionary = new Dictionary<string, string>();
            foreach (OperationDescription operation in serviceEndpoint.Contract.Operations)
            {
                try
                {
                    operationNameDictionary.Add(operation.Name.ToLower(), operation.Name);
                }
                catch (ArgumentException)
                {
                    throw new Exception(String.Format("The specified contract cannot be used with case insensitive URI dispatch because there is more than one operation named {0}", operation.Name));
                }
            }
            endpointDispatcher.AddressFilter = new PrefixEndpointAddressMessageFilter(serviceEndpoint.Address);
            endpointDispatcher.ContractFilter = new MatchAllMessageFilter();
            endpointDispatcher.DispatchRuntime.OperationSelector = new UriPathSuffixOperationSelector(serviceEndpoint.Address.Uri, operationNameDictionary);
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:25,代码来源:EnableHttpGetRequestsBehavior.cs


示例16: InvalidOperationException

 void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, EndpointDispatcher endpointDispatcher)
 {
     if (endpointDispatcher.DispatchRuntime.ReleaseServiceInstanceOnTransactionComplete)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoBatchingForReleaseOnComplete)));
     if (serviceEndpoint.Contract.SessionMode == SessionMode.Required)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxNoBatchingForSession)));
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:TransactedBatchingBehavior.cs


示例17: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (DispatchOperation operation in endpointDispatcher.DispatchRuntime.Operations)
     {
         operation.ParameterInspectors.Add(new OperationProfilerParameterInspector(this.manager, operation.IsOneWay));
     }
 }
开发者ID:khaledm,项目名称:wcffacilitytest,代码行数:7,代码来源:OperationProfilerEndpointBehavior.cs


示例18: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (var operation in endpointDispatcher.DispatchRuntime.Operations)
     {
         operation.CallContextInitializers.Add(_callContextInitializer);
     }
 }
开发者ID:khaledm,项目名称:wcffacilitytest,代码行数:7,代码来源:TestEndpointBehavior.cs


示例19: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (var operation in endpoint.Contract.Operations.Where(o => Methods.Contains(o.Name)))
     {
         operation.Behaviors.Find<DataContractSerializerOperationBehavior>().DataContractSurrogate = new JavascriptCallbackSurrogate(callbackFactory);
     }
 }
开发者ID:Creo1402,项目名称:CefSharp,代码行数:7,代码来源:JavascriptCallbackEndpointBehavior.cs


示例20: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     List<OperationDescription> corsEnabledOperations = endpoint.Contract.Operations
         .Where(o => o.Behaviors.Find<CorsEnabledAttribute>() != null)
         .ToList();
     endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new CorsEnabledMessageInspector(corsEnabledOperations));
 }
开发者ID:GusLab,项目名称:WCFSamples,代码行数:7,代码来源:EnableCorsEndpointBehavior.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Dispatcher.MessageRpc类代码示例发布时间:2022-05-26
下一篇:
C# Dispatcher.DispatchRuntime类代码示例发布时间: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