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

C# Description.ServiceDescription类代码示例

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

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



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


示例16:

 /// <summary>
 /// Adds the binding parameters.
 /// </summary>
 /// <param name="description">The description.</param>
 /// <param name="serviceHostBase">The service host base.</param>
 /// <param name="endpoints">The endpoints.</param>
 /// <param name="parameters">The parameters.</param>
 void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection parameters)
 {
     if (throttlingBehavior != null)
     {
         ((IServiceBehavior)throttlingBehavior).AddBindingParameters(description, serviceHostBase, endpoints, parameters);
     }
 }
开发者ID:ChristianWeyer,项目名称:Thinktecture.ServiceModel,代码行数:14,代码来源:InstancePoolingBehavior.cs


示例17: ApplyDispatchBehavior

        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
        {
            var authenticationBehavior =
                serviceHostBase.Description.FindBehavior
                        <WebAuthenticationConfigurationBehavior,
                        WebAuthenticationConfigurationAttribute>(b => b.BaseBehavior);

            if (authenticationBehavior == null)
                throw new ServiceAuthenticationConfigurationMissingException();

            var authenticationHandler = authenticationBehavior.AuthenticationHandler;
            var usernamePasswordValidator = authenticationBehavior.UsernamePasswordValidatorType;

            var authorizationBehavior =
                serviceHostBase.Description.FindBehavior
                    <WebAuthorizationConfigurationBehavior,
                    WebAuthorizationConfigurationAttribute>(b => b.BaseBehavior);

            Type authorizationPolicy = null;
            if (authorizationBehavior != null)
                authorizationPolicy = authorizationBehavior.AuthorizationPolicyType;

            foreach (ChannelDispatcher dispatcher in
                serviceHostBase.ChannelDispatchers)
                foreach (var endpoint in dispatcher.Endpoints)
                    endpoint.DispatchRuntime.MessageInspectors.Add(
                        new ServiceAuthenticationInspector(
                            authenticationHandler,
                            usernamePasswordValidator,
                            authenticationBehavior.RequireSecureTransport,
                            authenticationBehavior.Source,
                            authorizationPolicy));
        }
开发者ID:wildart,项目名称:WcfRestContrib,代码行数:33,代码来源:ServiceAuthenticationBehavior.cs


示例18:

		void IServiceBehavior.AddBindingParameters (
			ServiceDescription description,
			ServiceHostBase serviceHostBase,
			Collection<ServiceEndpoint> endpoints,
			BindingParameterCollection parameters)
		{
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:ServiceMetadataBehavior.cs


示例19: ApplyDispatchBehavior

 public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
 {
     foreach (ServiceEndpoint endpoint in serviceDescription.Endpoints)
     {
         var type = endpoint.Contract.ContractType;
         foreach (OperationDescription operation in endpoint.Contract.Operations)
         {
             var method = operation.SyncMethod;
             foreach (MessageDescription msg in operation.Messages)
             {
                 string actionname = msg.Action.ToLower();
                 var nosessions = method.GetCustomAttributes(typeof(NoSessionAttribute), true);
                 if (nosessions == null || nosessions.Length == 0)
                     SessionCallContextInitializer.NoSessions.Add(actionname, false);
                 else
                     SessionCallContextInitializer.NoSessions.Add(actionname, true);
             }
         }
     }
     foreach (ChannelDispatcher channelDispatcher in serviceHostBase.ChannelDispatchers)
     {
         foreach (EndpointDispatcher endpoint in channelDispatcher.Endpoints)
         {
             //endpoint.DispatchRuntime.MessageInspectors.Add(new SessionCallContextInitializer(messageHeaderInfo));
             foreach (DispatchOperation operation in endpoint.DispatchRuntime.Operations)
             {
                 operation.CallContextInitializers.Add(new SessionCallContextInitializer(messageHeaderInfo));
             }
         }
     }
 }
开发者ID:dishiyicijinqiu,项目名称:OneCardAccess,代码行数:31,代码来源:SessionServerBehavior.cs


示例20: MexInstanceContextProvider

		void IServiceBehavior.ApplyDispatchBehavior (
			ServiceDescription description,
			ServiceHostBase serviceHostBase) {

			ServiceMetadataExtension sme = ServiceMetadataExtension.EnsureServiceMetadataExtension (serviceHostBase);

			//Find ChannelDispatcher for Mex, and add a MexInstanceContextProvider
			//to it
			foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers) {
				ChannelDispatcher cd = cdb as ChannelDispatcher;
				if (cd == null)
					continue;

				foreach (EndpointDispatcher ed in cd.Endpoints) {
					if (ed.ContractName == MexContractName)
						ed.DispatchRuntime.InstanceContextProvider = new MexInstanceContextProvider (serviceHostBase);
				}
			}

			if (HttpGetEnabled) {
				Uri uri = serviceHostBase.CreateUri ("http", HttpGetUrl);
				if (uri != null)
					sme.EnsureChannelDispatcher (true, "http", uri, HttpGetBinding);
			}

			if (HttpsGetEnabled) {
				Uri uri = serviceHostBase.CreateUri ("https", HttpsGetUrl);
				if (uri != null)
					sme.EnsureChannelDispatcher (true, "https", uri, HttpsGetBinding);
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:31,代码来源:ServiceMetadataBehavior.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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