本文整理汇总了C#中ServiceHostBase类的典型用法代码示例。如果您正苦于以下问题:C# ServiceHostBase类的具体用法?C# ServiceHostBase怎么用?C# ServiceHostBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceHostBase类属于命名空间,在下文中一共展示了ServiceHostBase类的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: DurableServiceAttribute
void IServiceBehavior.Validate(ServiceDescription description,ServiceHostBase host)
{
DurableServiceAttribute durable = new DurableServiceAttribute();
durable.SaveStateInOperationTransaction = true;
description.Behaviors.Add(durable);
PersistenceProviderFactory factory;
if(AutoCompleteInstance)
{
factory = new TransactionalInstanceProviderFactory();
}
else
{
factory = new TransactionalMemoryProviderFactory();
}
PersistenceProviderBehavior persistenceBehavior = new PersistenceProviderBehavior(factory);
description.Behaviors.Add(persistenceBehavior);
if(TransactionRequiredAllOperations)
{
foreach(ServiceEndpoint endpoint in description.Endpoints)
{
foreach(OperationDescription operation in endpoint.Contract.Operations)
{
operation.Behaviors.Find<OperationBehaviorAttribute>().TransactionScopeRequired = true;
}
}
}
}
开发者ID:JMnITup,项目名称:SMEX,代码行数:30,代码来源:TransactionalBehaviorAttribute.cs
示例3: AddBindingParameters
public void AddBindingParameters(
ServiceDescription serviceDescription,
ServiceHostBase serviceHostBase,
Collection<ServiceEndpoint> endpoints,
BindingParameterCollection bindingParameters)
{
}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:7,代码来源:DependencyServiceBehavior.cs
示例4: ArgumentException
void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
{
IErrorHandler errorHandler;
try
{
errorHandler = (IErrorHandler)Activator.CreateInstance(m_errorHandlerType, m_tracer);
}
catch (MissingMethodException e)
{
throw new ArgumentException(string.Format(
"The errorHandlerType {0} must have a public constructor with single argument of type {1}",
m_errorHandlerType.AssemblyQualifiedName, typeof(ITracer).AssemblyQualifiedName)
, e);
}
catch (InvalidCastException e)
{
throw new ArgumentException(string.Format(
"The errorHandlerType {0} must implement System.ServiceModel.Dispatcher.IErrorHandler.",
m_errorHandlerType.AssemblyQualifiedName), e);
}
foreach (var channelDispatcherBase in serviceHostBase.ChannelDispatchers)
{
var channelDispatcher = channelDispatcherBase as ChannelDispatcher;
if (channelDispatcher != null)
{
channelDispatcher.ErrorHandlers.Add(errorHandler);
}
}
}
开发者ID:adrobyazko-softheme,项目名称:PQL,代码行数:31,代码来源:ErrorBehaviorAttribute.cs
示例5: AddBindingParameters
/// <summary>
/// Provides the ability to pass custom data to binding elements to support the contract implementation.
/// </summary>
/// <param name="serviceDescription">
/// The service description of the service.
/// </param>
/// <param name="serviceHostBase">
/// The host of the service.
/// </param>
/// <param name="endpoints">
/// The service endpoints.
/// </param>
/// <param name="bindingParameters">
/// Custom objects to which binding elements have access.
/// </param>
public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters)
{
foreach (ChannelDispatcher chanDisp in serviceHostBase.ChannelDispatchers)
{
chanDisp.ErrorHandlers.Add(new ErrorHandler(this._messageFaultBuilder));
}
}
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:22,代码来源:SdmxErrorServiceBehaviour.cs
示例6: 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
示例7: DefaultPerformanceCounters
internal DefaultPerformanceCounters(ServiceHostBase serviceHost)
{
this.instanceName = DefaultPerformanceCounters.CreateFriendlyInstanceName(serviceHost);
this.Counters = new PerformanceCounter[(int)PerfCounters.TotalCounters];
for (int i = 0; i < (int)PerfCounters.TotalCounters; i++)
{
try
{
PerformanceCounter counter = PerformanceCounters.GetDefaultPerformanceCounter(this.perfCounterNames[i], this.instanceName);
if (counter != null)
{
this.Counters[i] = counter;
}
else
{
break;
}
}
#pragma warning suppress 56500 // covered by FxCOP
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
if (DiagnosticUtility.ShouldTraceError)
{
TraceUtility.TraceEvent(TraceEventType.Error, TraceCode.PerformanceCountersFailedForService,
SR.GetString(SR.TraceCodePerformanceCountersFailedForService), null, e);
}
break;
}
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:DefaultPerformanceCounters.cs
示例8: 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
示例9: ListenerHandler
internal ListenerHandler(IListenerBinder listenerBinder, System.ServiceModel.Dispatcher.ChannelDispatcher channelDispatcher, ServiceHostBase host, ServiceThrottle throttle, IDefaultCommunicationTimeouts timeouts)
{
this.listenerBinder = listenerBinder;
if (this.listenerBinder == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("listenerBinder");
}
this.channelDispatcher = channelDispatcher;
if (this.channelDispatcher == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("channelDispatcher");
}
this.host = host;
if (this.host == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("host");
}
this.throttle = throttle;
if (this.throttle == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("throttle");
}
this.timeouts = timeouts;
this.endpoints = channelDispatcher.EndpointDispatcherTable;
this.acceptor = new ErrorHandlingAcceptor(listenerBinder, channelDispatcher);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ListenerHandler.cs
示例10: RegisterErrorHandlerBehavior
private void RegisterErrorHandlerBehavior(ErrorHandlerBehavior errorHandlerBehavior, ServiceHostBase host)
{
if (host.Description.Behaviors.Find<ErrorHandlerBehavior>() == null)
{
host.Description.Behaviors.Add(errorHandlerBehavior);
}
}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:7,代码来源:EncapsulatedHost.cs
示例11: CreateServiceCounters
internal static ServicePerformanceCountersBase CreateServiceCounters(ServiceHostBase serviceHost)
{
if (OSEnvironmentHelper.IsVistaOrGreater)
{
try
{
ServicePerformanceCountersV2 sv = new ServicePerformanceCountersV2(serviceHost);
EndpointPerformanceCountersV2.EnsureCounterSet();
OperationPerformanceCountersV2.EnsureCounterSet();
return sv;
}
catch (Exception exception)
{
if (Fx.IsFatal(exception))
{
throw;
}
PerformanceCounters.Scope = PerformanceCounterScope.Off;
if (DiagnosticUtility.ShouldTraceError)
{
TraceUtility.TraceEvent(TraceEventType.Error, 0x8003b, System.ServiceModel.SR.GetString("TraceCodePerformanceCountersFailedForService"), null, exception);
}
return null;
}
}
return new ServicePerformanceCounters(serviceHost);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:PerformanceCountersFactory.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: ArgumentException
void IServiceBehavior.ApplyDispatchBehavior(
ServiceDescription serviceDescription,
ServiceHostBase serviceHostBase)
{
IErrorHandler errorHandler;
try
{
errorHandler = (IErrorHandler)Activator.CreateInstance(errorHandlerType);
}
catch (MissingMethodException e)
{
throw new ArgumentException(
"The errorHandlerType specified in the ErrorBehaviorAttribute constructor must have a public empty constructor.",
e);
}
catch (InvalidCastException e)
{
throw new ArgumentException(
"The errorHandlerType specified in the ErrorBehaviorAttribute constructor must implement System.ServiceModel.Dispatcher.IErrorHandler.",
e);
}
foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers)
{
var channelDispatcher = channelDispatcherBase as ChannelDispatcher;
channelDispatcher.ErrorHandlers.Add(errorHandler);
}
}
开发者ID:OscarNET,项目名称:Hexa.Core,代码行数:29,代码来源:ErrorBehaviorAttribute.cs
示例16: ServiceInfo
internal ServiceInfo(ServiceHostBase service)
{
this.service = service;
this.behaviors = service.Description.Behaviors;
this.serviceName = service.Description.Name;
this.endpoints = new EndpointInfoCollection(service.Description.Endpoints, this.ServiceName);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ServiceInfo.cs
示例17: ApplyDispatchBehavior
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
var eh=new ErrorHandler();
foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers)
((ChannelDispatcher)cdb).ErrorHandlers.Insert(0, eh);
}
开发者ID:mcartoixa,项目名称:GeoSIK,代码行数:7,代码来源:FaultBehavior.cs
示例18: ServiceDurableInstanceContextProvider
public ServiceDurableInstanceContextProvider(
ServiceHostBase serviceHostBase,
bool isPercall,
Type serviceType,
PersistenceProviderFactory providerFactory,
bool saveStateInOperationTransaction,
UnknownExceptionAction unknownExceptionAction,
DurableRuntimeValidator runtimeValidator,
TimeSpan operationTimeout)
: base(serviceHostBase, isPercall)
{
if (serviceType == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("serviceType");
}
if (providerFactory == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("providerFactory");
}
if (runtimeValidator == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("runtimeValidator");
}
this.serviceType = serviceType;
this.providerFactory = providerFactory;
this.saveStateInOperationTransaction = saveStateInOperationTransaction;
this.unknownExceptionAction = unknownExceptionAction;
this.runtimeValidator = runtimeValidator;
this.operationTimeout = operationTimeout;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:33,代码来源:ServiceDurableInstanceContextProvider.cs
示例19: AddBindingParameters
public virtual void AddBindingParameters(ServiceDescription serviceDescription,
ServiceHostBase serviceHostBase,
Collection<ServiceEndpoint> endpoints,
BindingParameterCollection bindingParameters)
{
throw new NotImplementedException();
}
开发者ID:devworker55,项目名称:Mammatus,代码行数:7,代码来源:ServiceBehaviorBase.cs
示例20:
/// <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
注:本文中的ServiceHostBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论