Esempio n. 1
0
        private void ServiceOpening(ServiceHost serviceHost)
        {
            var e = new WcfServiceHostConfigureEventArgs(serviceHost, ContractType, ServiceType);

            OnConfiguring(e);

            if (e.Cancel)
            {
                return;
            }

            _behaviors.ForEach(b =>
            {
                if (!serviceHost.Description.Behaviors.Contains(b.GetType()))
                {
                    serviceHost.Description.Behaviors.Add(b);
                }
            });
            _endPoints.ForEach(
                endPointParameter =>
            {
                var serviceEndpoint = serviceHost.AddServiceEndpoint(ContractType, endPointParameter.Binding,
                                                                     endPointParameter.Address);
                endPointParameter.Behaviors.ForEach(endPointBehavior => serviceEndpoint.Behaviors.Add(endPointBehavior));
            });
        }
Esempio n. 2
0
        protected void OnConfiguring(WcfServiceHostConfigureEventArgs e)
        {
            EventHandler <WcfServiceHostConfigureEventArgs> handler = Configuring;

            if (handler != null)
            {
                handler(this, e);
            }
        }