Example #1
0
        public WcfServiceHost(IContainer container, Type serviceType, bool includeExceptionDetailInFaults, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        {
            logger.Debug($"Starting service host for {serviceType.FullName} at {string.Join(",", baseAddresses.Select(x => x.ToString()))}", ".ctor");
            this.Container = container;


            foreach (var contract in ImplementedContracts.Values)
            {
                logger.Trace($"Adding behaviour for contract {contract.Name}", ".ctor");
                var provider  = new WcfInstanceProvider(container);
                var behaviour = new WcfInstanceBehaviour(provider);
                contract.Behaviors.Add(behaviour);
            }

            if (includeExceptionDetailInFaults)
            {
                var serviceDebugBehaviour = this.Description.Behaviors
                                            .OfType <ServiceDebugBehavior>()
                                            .FirstOrDefault();

                if (serviceDebugBehaviour == null)
                {
                    serviceDebugBehaviour = new ServiceDebugBehavior();
                    this.Description.Behaviors.Add(serviceDebugBehaviour);
                }

                serviceDebugBehaviour.IncludeExceptionDetailInFaults = true;
                logger.Trace("Setting IncludeExceptionDetailInFaults = true", ".ctor");
            }
        }
Example #2
0
 public WcfInstanceBehaviour(WcfInstanceProvider instanceProvider)
 {
     this.instanceProvider = instanceProvider;
 }