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


C# Dispatcher.EndpointDispatcher类代码示例

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


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


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