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


C# Description.ServiceDescription类代码示例

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


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

示例1: ApplyDispatchBehavior

        public virtual void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            string workflowDisplayName = "";
            System.ServiceModel.Activities.WorkflowServiceHost workflowServiceHost = serviceHostBase as System.ServiceModel.Activities.WorkflowServiceHost;
            if (null != workflowServiceHost)
            {
                workflowDisplayName = ((System.ServiceModel.Activities.WorkflowServiceHost)serviceHostBase).Activity.DisplayName;
            }

            System.ServiceModel.Activities.WorkflowServiceHost host = serviceHostBase as System.ServiceModel.Activities.WorkflowServiceHost;
            if (this.TrackingComponentElements != null && host != null)
            {
                foreach (TrackingComponentElement trackingComponentElement in this.TrackingComponentElements)
                {
                    TrackingParticipant trackingComponent = this.CreateTrackingComponent(trackingComponentElement);
                    if (trackingComponent != null)
                    {
                        if (!string.IsNullOrEmpty(trackingComponentElement.ProfileName))
                        {
                            trackingComponent.TrackingProfile = this.GetProfile(trackingComponentElement.ProfileName, workflowDisplayName);
                        }

                        host.WorkflowExtensions.Add(trackingComponent);
                    }
                    else
                    {
                        throw new Exception(string.Format("Tracking component is not a known type: {0}", trackingComponentElement.Name));
                    }
                }
            }
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:31,代码来源:GenericTrackingBehavior.cs

示例2: ApplyDispatchBehavior

        /// <summary>
        /// Provides the ability to change run-time property values or insert custom extension objects such as error handlers, message or parameter interceptors, security extensions, and other custom extension objects.
        /// </summary>
        /// <param name="serviceDescription">The service description.</param>
        /// <param name="serviceHostBase">The host that is currently being built.</param>
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            var instanceProvider =
                new ServiceInstanceProvider(this.ServiceType);

            var implementors =
                from end in serviceDescription.Endpoints
                where end.Contract.ContractType.IsAssignableFrom(this.ServiceType)
                select end.Contract.Name;

            foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers)
            {
                ChannelDispatcher channelDispatcher =
                    channelDispatcherBase as ChannelDispatcher;

                if (channelDispatcher != null)
                {
                    foreach (EndpointDispatcher endPoint in channelDispatcher.Endpoints)
                    {
                        if (implementors.Contains(endPoint.ContractName))
                            endPoint.DispatchRuntime.InstanceProvider = instanceProvider;
                    }
                }
            }
        }
开发者ID:xinmyname,项目名称:Common-Service-Factory,代码行数:30,代码来源:ServiceBehavior.cs

示例3: AddBindingParameters

		public void AddBindingParameters(
			ServiceDescription serviceDescription,
			ServiceHostBase serviceHostBase,
			Collection<ServiceEndpoint> endpoints,
			BindingParameterCollection bindingParameters)
		{
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:7,代码来源:DependencyServiceBehavior.cs

示例4: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
 {
     foreach (ChannelDispatcher channelDispatcher in serviceHostBase.ChannelDispatchers)
     {
         channelDispatcher.ErrorHandlers.Add(new ServiceErrorHandler(this.ExceptionPolicyName));
     }
 }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:7,代码来源:ExceptionHandlingBehaviorAttribute.cs

示例5: ApplyDispatchBehavior

 /// <summary>
 /// Provides the ability to change run-time property values or insert custom extension objects such as error handlers, message or parameter interceptors, security extensions, and other custom extension objects.
 /// </summary>
 /// <param name="serviceDescription">The service description.</param>
 /// <param name="serviceHostBase">The host that is currently being built.</param>
 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
 {
     foreach (var endpoint in serviceDescription.Endpoints)
     {
         RegisterContract(endpoint);
     }
 }
开发者ID:liquidsnk,项目名称:Aspid,代码行数:12,代码来源:NetDataContractSerializerAttribute.cs

示例6: AddBindingParameters

 public virtual void AddBindingParameters(ServiceDescription serviceDescription,
                                          ServiceHostBase serviceHostBase,
                                          Collection<ServiceEndpoint> endpoints,
                                          BindingParameterCollection bindingParameters)
 {
     throw new NotImplementedException();
 }
开发者ID:devworker55,项目名称:Mammatus,代码行数:7,代码来源:ServiceBehaviorBase.cs

示例7: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
 {
     foreach (ChannelDispatcher chanDisp in serviceHostBase.ChannelDispatchers)
     {
         chanDisp.ErrorHandlers.Add(this);
     }
 }
开发者ID:san90279,项目名称:UK_OAS,代码行数:7,代码来源:SilverlightFaultBehavior.cs

示例8: AddBehaviors

        void AddBehaviors(ServiceDescription service)
        {
            // The philosophy here is to respect settings from configuration
            // At the moment, none of the settings we care about can be modified
            // through configuration. That may change in the future.
            // However, we never want to silently overwrite a user's configuration.
            // So we should either accept overrides or reject them, but never 
            // silently update them.
            //

            ServiceBehaviorAttribute serviceBehavior = EnsureBehaviorAttribute(service);

            serviceBehavior.InstanceProvider = new ComPlusInstanceProvider(this.info);

            serviceBehavior.InstanceContextMode = InstanceContextMode.Single;

            // SHOULD: There is no reason to not allow concurrency at this level
            serviceBehavior.ConcurrencyMode = ConcurrencyMode.Multiple;
            serviceBehavior.UseSynchronizationContext = false;

            service.Behaviors.Add(new SecurityCookieModeValidator());

            if (AspNetEnvironment.Enabled)
            {
                AspNetCompatibilityRequirementsAttribute aspNetCompatibilityRequirements = service.Behaviors.Find<AspNetCompatibilityRequirementsAttribute>();
                if (aspNetCompatibilityRequirements == null)
                {
                    aspNetCompatibilityRequirements = new AspNetCompatibilityRequirementsAttribute();
                    service.Behaviors.Add(aspNetCompatibilityRequirements);
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:32,代码来源:ComPlusServiceLoader.cs

示例9: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
        {
            /* IMPORTANT NOTE:
             * This service behavior assumes that the said operation and endpoint behaviors are stateless.
             * As a result it uses the same instance of the behaviors across all endpoints and operations.
             * All changes to these  behaviors need to ensure that the STATELESSNESS IS MAINTAINED.
             */

            lock (_syncRoot)
            {
                // Get endpoint and operation behaviors.
                // Install behaviors
                for (int i = 0; i < serviceDescription.Endpoints.Count; i++)
                {
                    var endpoint = serviceDescription.Endpoints[i];
                    // Add operation behavior

                    // Add the operation behavior to the endpoint
                    for (int j = 0; j < endpoint.Contract.Operations.Count; j++)
                    {
                        var operation = endpoint.Contract.Operations[j];
                        if (operation.Behaviors.Contains(typeof(AllowAsyncService)) == false)
                            operation.Behaviors.Add(this);
                    }

                }
            }
        }
开发者ID:ytokas,项目名称:appacitive-dotnet-sdk,代码行数:28,代码来源:AllowAsyncServiceBehavior.cs

示例10: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
        {
            var errorhandlers = this.behaviorTypes.Where(t => t.GetInterfaces().Any(i=>i == typeof(IErrorHandler))).ToList();
            var messageinspectors = this.behaviorTypes.Where(t => t.GetInterfaces().Any(i => i == typeof(IDispatchMessageInspector))).ToList();

            foreach (ChannelDispatcher cd in serviceHostBase.ChannelDispatchers)
            {
                //add error handlers to all channel dispatchers
                foreach (var errorhandler in errorhandlers)
                {
                    var handler = (IErrorHandler)Activator.CreateInstance(errorhandler);
                    cd.ErrorHandlers.Add(handler);
                }

                //add message inspectors to all endpoints
                foreach (EndpointDispatcher ed in cd.Endpoints)
                {
                    foreach (var messageinspector in messageinspectors)
                    {
                        var inspector = (IDispatchMessageInspector)Activator.CreateInstance(messageinspector);
                        ed.DispatchRuntime.MessageInspectors.Add(inspector);
                    }
                }
            }

        }
开发者ID:kiszu,项目名称:ForBlog,代码行数:26,代码来源:CustomBehaviorAttribute.cs

示例11: ApplyDispatchBehavior

 /// <summary>
 ///   Provides the ability to change run-time property values or insert custom extension objects such as exception handlers, message or parameter interceptors, security extensions, and other custom extension objects.
 /// </summary>
 /// <param name = "serviceDescription">The service description.</param>
 /// <param name = "serviceHostBase">The host that is currently being built.</param>
 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
 {
     foreach (ChannelDispatcher chanDisp in serviceHostBase.ChannelDispatchers)
     {
         chanDisp.ErrorHandlers.Add(new LastChanceErrorHandler());
     }
 }
开发者ID:pullpush,项目名称:NAd,代码行数:12,代码来源:ExceptionShieldingBehavior.cs

示例12: ApplyDispatchBehavior

		public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
		{
			foreach (ChannelDispatcher channelDispatcher in serviceHostBase.ChannelDispatchers)
			{
				channelDispatcher.ErrorHandlers.Add(errorHandler);
			}
		}
开发者ID:codereflection,项目名称:Castle.Facilities.Wcf,代码行数:7,代码来源:WcfErrorBehavior.cs

示例13: ApplyDispatchBehavior

 //- @ApplyDispatchBehavior -//
 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
 {
     foreach (ChannelDispatcher dispatcher in serviceHostBase.ChannelDispatchers)
     {
         dispatcher.ErrorHandlers.Add(new ErrorHandler(serviceDescription.ServiceType));
     }
 }
开发者ID:davidbetz,项目名称:Nalarium.ServiceModel,代码行数:8,代码来源:FaultHandlingBehavior.cs

示例14: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            if (serviceDescription == null)
            {
                throw new ArgumentNullException("serviceDescription");
            }

            if (serviceHostBase == null)
            {
                throw new ArgumentNullException("serviceHostBase");
            }

            for (var dispatcherIndex = 0;
                 dispatcherIndex < serviceHostBase.ChannelDispatchers.Count;
                 dispatcherIndex++)
            {
                var dispatcher = serviceHostBase.ChannelDispatchers[dispatcherIndex];
                var channelDispatcher = (ChannelDispatcher)dispatcher;
                for (var endpointIndex = 0; endpointIndex < channelDispatcher.Endpoints.Count; endpointIndex++)
                {
                    var endpointDispatcher = channelDispatcher.Endpoints[endpointIndex];
                    endpointDispatcher.DispatchRuntime.InstanceProvider = 
                        new UnityInstanceProvider(this.Container, serviceDescription.ServiceType);
                }
            } 
        }
开发者ID:RustyF,项目名称:EnergyTrading-Core,代码行数:26,代码来源:UnityServiceBehavior.cs

示例15: Validate

        // The validation process will scan each endpoint to see if it's bindings have binding elements
        // that are secure. These elements consist of: Transport, Asymmetric, Symmetric,
        // HttpsTransport, WindowsStream and SSLStream.
        public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            // Loop through each endpoint individually gathering their binding elements.
            foreach (ServiceEndpoint endpoint in serviceDescription.Endpoints)
            {
                secureElementFound = false;

                // Retrieve the endpoint's binding element collection.
                BindingElementCollection bindingElements = endpoint.Binding.CreateBindingElements();

                // Look to see if the binding elements collection contains any secure binding
                // elements. Transport, Asymmetric and Symmetric binding elements are all
                // derived from SecurityBindingElement.
                if ((bindingElements.Find<SecurityBindingElement>() != null) ||
                    (bindingElements.Find<HttpsTransportBindingElement>() != null) ||
                    (bindingElements.Find<WindowsStreamSecurityBindingElement>() != null) ||
                    (bindingElements.Find<SslStreamSecurityBindingElement>() != null))
                {
                    secureElementFound = true;
                }

                // Send a message to the system event viewer whhen an endpoint is deemed insecure.
                if (!secureElementFound)
                    throw new Exception(System.DateTime.Now.ToString() + ": The endpoint \"" + endpoint.Name + "\" has no secure bindings.");
            }
        }
开发者ID:ssickles,项目名称:archive,代码行数:29,代码来源:endpointValidateBehavior.cs


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