using System; using System.ServiceModel; using System.ServiceModel.Description; namespace Sony.Filtr.API.WCF { public class FiltrServiceServiceHost : ServiceHost { public FiltrServiceServiceHost() { } public FiltrServiceServiceHost(Type serviceType, params Uri[] baseAddresses) : base(serviceType, baseAddresses) { } protected override void OnOpening() { if (Description != null) { foreach (var endpoint in Description.Endpoints) { if (endpoint.Binding != null) { var webHttpBinding = endpoint.Binding as WebHttpBinding; if (webHttpBinding != null) { ArrayConverterBehavior arrayConverterBehavior = new ArrayConverterBehavior(); endpoint.Behaviors.Add(arrayConverterBehavior); } } } Description.Behaviors.Add(new StructureMapServiceBehavior()); var errorBehavior = new ServiceErrorBehaviourAttribute(typeof (ErrorHandler)); Description.Behaviors.Add(errorBehavior); Description.Behaviors.Add(new ServiceMetadataBehavior() { HttpGetEnabled = true}); Description.Behaviors.Add(new ServiceThrottlingBehavior() { MaxConcurrentCalls = 64, MaxConcurrentInstances = 64, MaxConcurrentSessions = 64}); } base.OnOpening(); } } }