internal ProcessInfoData(ServiceHostBase Host) { if (Host == null) { lastError = "FATALERROR: Host cannot be null (ProcessInfo)"; return; } try { serviceName = Host.Description.Name; maxCalls = 0; maxInstances = 0; calls = 0; sessions = 0; maxCalls = Host.GetMaxCalls(); MaxSessions = Host.GetMaxSessions(); MaxInstances = Host.GetMaxInstances(); sessions = Host.GetCurrentSessions(); calls = Host.GetCurrentCalls(); servicehostType = Host.GetServiceType().ToString(); serviceConcurrencyMode = Host.GetConcurrencyMode(); instanceContextMode = Host.GetInstanceContextMode(); serviceBehaviors = Host.GetServiceBehaviors(); } catch (Exception ex) { lastError = ex.Message; } }
public WcfServiceBehavior(string strPerformanceCounters, ConcurrencyMode enuConcurrencyMode, InstanceContextMode enuInstanceContextMode) : base() { PerformanceCounters = strPerformanceCounters; ConcurrencyMode = enuConcurrencyMode; InstanceContextMode = enuInstanceContextMode; }
void ValidateAutoCompleteFalseRequirements(ServiceDescription service, ServiceEndpoint endpoint) { OperationDescription autoCompleteFalseOperation = GetAutoCompleteFalseOperation(endpoint); if (autoCompleteFalseOperation != null) { // Does the service have InstanceContextMode.PerSession or Shareable? ServiceBehaviorAttribute serviceBehavior = service.Behaviors.Find <ServiceBehaviorAttribute>(); if (serviceBehavior != null) { InstanceContextMode instanceMode = serviceBehavior.InstanceContextMode; if (instanceMode != InstanceContextMode.PerSession) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.SFxTransactionAutoCompleteFalseAndInstanceContextMode, endpoint.Contract.Name, autoCompleteFalseOperation.Name))); } } // Does the binding support sessions? if (!autoCompleteFalseOperation.IsInsideTransactedReceiveScope) { if (!RequiresSessions(endpoint)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.SFxTransactionAutoCompleteFalseAndSupportsSession, endpoint.Contract.Name, autoCompleteFalseOperation.Name))); } } } }
static public bool IsDefined(InstanceContextMode x) { return (x == InstanceContextMode.PerCall || x == InstanceContextMode.PerSession || x == InstanceContextMode.Single); }
public WCFService( ConcurrencyMode concurrencyMode, InstanceContextMode instanceContextMode) { this.concurrencyMode = concurrencyMode; this.instanceContextMode = instanceContextMode; }
public override void ReadData(SerializedObject objSerializedObject) { base.ReadData(objSerializedObject); PerformanceCounters = objSerializedObject.Values.GetValue <string>("PerformanceCounters", DefaultPerformanceCounters); ConcurrencyMode = objSerializedObject.Values.GetValue <ConcurrencyMode>("ConcurrencyMode", DefaultConcurrencyMode); InstanceContextMode = objSerializedObject.Values.GetValue <InstanceContextMode>("InstanceContextMode", DefaultInstanceContextMode); }
public static bool IsDefined(InstanceContextMode x) { if ((x != InstanceContextMode.PerCall) && (x != InstanceContextMode.PerSession)) { return(x == InstanceContextMode.Single); } return(true); }
public override void ReadData(BinaryReaderExtension objBinaryReader) { base.ReadData(objBinaryReader); PerformanceCounters = objBinaryReader.ReadString(); ConcurrencyMode = objBinaryReader.ReadEnum <ConcurrencyMode>(); InstanceContextMode = objBinaryReader.ReadEnum <InstanceContextMode>(); }
public static bool IsDefined(InstanceContextMode x) { if ((x != InstanceContextMode.PerCall) && (x != InstanceContextMode.PerSession)) { return (x == InstanceContextMode.Single); } return true; }
static public bool IsDefined(InstanceContextMode x) { return x == InstanceContextMode.PerCall || x == InstanceContextMode.PerSession || x == InstanceContextMode.Single || false; }
public static void AddInstanceContextMode(this ServiceHostBase host, InstanceContextMode mode) { ServiceHostData data = GetServiceHostData(host); if (data != null) { data.ServiceInstanceContextMode = mode; } }
public ServiceConfigurationAttribute(string behaviorConfiguration, bool customErrorHandler, TransferMode transferMode, InstanceContextMode instanceContextMode, ConcurrencyMode concurencyMode, params string[] bindingConfiguration) { InstanceContextMode = instanceContextMode; ConcurrencyMode = concurencyMode; CustomErrorHandler = customErrorHandler; TransferMode = transferMode; BehaviorConfiguration = behaviorConfiguration; BindingConfiguration = bindingConfiguration; }
internal static IInstanceContextProvider GetProviderForMode(InstanceContextMode instanceMode, DispatchRuntime runtime) { switch (instanceMode) { case InstanceContextMode.PerSession: return new PerSessionInstanceContextProvider(runtime); default: throw new PlatformNotSupportedException(); } }
internal static IInstanceContextProvider GetProviderForMode(InstanceContextMode instanceMode, DispatchRuntime runtime) { switch (instanceMode) { case InstanceContextMode.PerSession: return(new PerSessionInstanceContextProvider(runtime)); default: throw new PlatformNotSupportedException(); } }
private static void ConfigureInstanceContextMode(ServiceHost host, InstanceContextMode mode) { ServiceBehaviorAttribute serviceBehaviorAttribute = host.Description.Behaviors.Find <ServiceBehaviorAttribute>(); if (serviceBehaviorAttribute == null) { serviceBehaviorAttribute = new ServiceBehaviorAttribute(); host.Description.Behaviors.Add(serviceBehaviorAttribute); } serviceBehaviorAttribute.InstanceContextMode = mode; }
private void ValidateTransactionAutoCompleteOnSessionCloseHasSession(System.ServiceModel.Description.ServiceDescription service) { ServiceBehaviorAttribute attribute = service.Behaviors.Find <ServiceBehaviorAttribute>(); if (attribute != null) { InstanceContextMode instanceContextMode = attribute.InstanceContextMode; if (attribute.TransactionAutoCompleteOnSessionClose && (instanceContextMode != InstanceContextMode.PerSession)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SFxTransactionAutoCompleteOnSessionCloseNoSession", new object[] { service.Name }))); } } }
void ValidateTransactionAutoCompleteOnSessionCloseHasSession(ServiceDescription service) { ServiceBehaviorAttribute serviceBehavior = service.Behaviors.Find <ServiceBehaviorAttribute>(); if (serviceBehavior != null) { InstanceContextMode instanceMode = serviceBehavior.InstanceContextMode; if (serviceBehavior.TransactionAutoCompleteOnSessionClose && instanceMode != InstanceContextMode.PerSession) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException( SR.GetString(SR.SFxTransactionAutoCompleteOnSessionCloseNoSession, service.Name))); } } }
internal static IInstanceContextProvider GetProviderForMode(InstanceContextMode instanceMode, DispatchRuntime runtime) { switch (instanceMode) { case InstanceContextMode.PerCall: return new PerCallInstanceContextProvider(runtime); case InstanceContextMode.PerSession: return new PerSessionInstanceContextProvider(runtime); case InstanceContextMode.Single: return new SingletonInstanceContextProvider(runtime); default: DiagnosticUtility.FailFast("InstanceContextProviderBase.GetProviderForMode: default"); return null; } }
internal static IInstanceContextProvider GetProviderForMode(InstanceContextMode instanceMode, System.ServiceModel.Dispatcher.DispatchRuntime runtime) { switch (instanceMode) { case InstanceContextMode.PerSession: return(new PerSessionInstanceContextProvider(runtime)); case InstanceContextMode.PerCall: return(new PerCallInstanceContextProvider(runtime)); case InstanceContextMode.Single: return(new SingletonInstanceContextProvider(runtime)); } DiagnosticUtility.FailFast("InstanceContextProviderBase.GetProviderForMode: default"); return(null); }
private ServiceHost CreateService(UserSettings settings, InstanceContextMode contextMode) { switch (contextMode) { case InstanceContextMode.PerSession: return(CreateServiceHost <IMyService, PerSessionMyService>(settings)); case InstanceContextMode.PerCall: return(CreateServiceHost <IMyService, PerCallMyService>(settings)); case InstanceContextMode.Single: return(CreateServiceHost <IMyService, SingleMyService>(settings)); default: throw new ArgumentOutOfRangeException(nameof(contextMode), contextMode, null); } }
static InstanceContext() { var type = typeof(T); InstanceContextMode = InstanceContextMode.PerCall; var serviceBehavior = type.GetTypeInfo().GetCustomAttribute <ServiceBehaviorAttribute>(false); if (serviceBehavior != null) { InstanceContextMode = serviceBehavior.InstanceContextMode; } GetOperations(type); if (OperationDispatchers.Count == 0) { throw new Exception("No OperationContract found"); } }
public static IHost InstanceContextMode(this IHost me, InstanceContextMode mode) { (me as _Host).ServiceHost.Description.Behaviors.Find <ServiceBehaviorAttribute>().InstanceContextMode = mode; return(me); }
private static void ConfigureInstanceContextMode(ServiceHost host, InstanceContextMode mode) { ServiceBehaviorAttribute serviceBehaviorAttribute = host.Description.Behaviors.Find<ServiceBehaviorAttribute>(); if (serviceBehaviorAttribute == null) { serviceBehaviorAttribute = new ServiceBehaviorAttribute(); host.Description.Behaviors.Add(serviceBehaviorAttribute); } serviceBehaviorAttribute.InstanceContextMode = mode; }
public ServiceServer(Uri uri, Binding binding, TServiceImpl singletonInstance = null, InstanceContextMode contextMode = InstanceContextMode.PerSession) { ServiceUri = uri; Binding = binding; Started = false; _threadLock = new object(); _singletonImpl = singletonInstance; ContextMode = _singletonImpl != null ? InstanceContextMode.Single : contextMode; }
public ServiceServer(Uri uri, InstanceContextMode contextMode = InstanceContextMode.PerSession) : this(uri, BindingFactory.CreateStandardBinding(), contextMode : contextMode) { }
public ServiceConfigurationAttribute(string behaviorConfiguration, bool customErrorHandler, InstanceContextMode instanceContextMode, params string[] bindingConfiguration) : this(behaviorConfiguration, customErrorHandler, TransferMode.Buffered, instanceContextMode, ConcurrencyMode.Single, bindingConfiguration) { }
public ServiceBehaviorAttribute() { this.InstanceContextMode = InstanceContextMode.PerSession; }