public void should_persist_servicetype_to_servicetype_property() { var behavior = new ServiceBehavior(typeof(FakeService)); behavior.ServiceType.ShouldBeOfType<FakeService>(); }
public static void LoadBehaviors(this ServiceHostBase host) { host.Description.Behaviors.Add(ServiceBehavior.CreateThrottlingBehavior()); host.Description.Behaviors.Add(ServiceBehavior.CreateMetadataBehavior(host.Description.Endpoints.FirstOrDefault().Binding)); host.Description.Endpoints.FirstOrDefault().Behaviors.Add(ServiceWebHttpBehaviors.CreateWebHttpBehavior()); }
/// <summary> /// Initializes the service. /// </summary> public override void Initialize() { if (CheckIsInitialized) { return; } try { InitializeDisposeLock.EnterWriteLock(); if (CheckIsInitialized) { return; } ServiceBehavior behavior = new ServiceBehavior(Protocol.Http, Transport.EnableSsl); behavior.SetBehavior(ServiceHost); ServiceHost.Open(); SubscribeToDataRequests(); } finally { InitializeDisposeLock.ExitWriteLock(); } }