當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。