I am creating a ServiceFactory to gain control over the initialization of my services open through IIS 7.
However, I am surprised at the behavior of ServiceHost. Although I have 0 configuration files for the service, wherever I initialize the new ServiceHost, for example:
var host = new ServiceHost(typeof(MyService), baseAddresses);
Next, I want to add some actions only if the assembly is in debug mode:
#if DEBUG
host.Description.Behaviors.Add(new ServiceDebugBehavior());
#endif
However, this code does not mean that ServiceDebugBehavior is already in use! Despite the fact that I do not have configuration files and no attributes applied to the service class, the host already has this behavior and 5 more are applied!
Is this the expected behavior? What if I want to disable ServiceDebugBehavior on releases?
Thanks in advance,