Reputation: 279
I am currently working on creating a custom service host factory, where I could add endpoints programmatically. Just wondering if I can have the service behaviour configured in the configuration file whilst I have created my service host and added the service endpoint(s) programmatically.
Will the behavior from the configuration file, along with added endpoints from the program side be picked up correctly? This is because I have two choices to create the ServiceHost instance.
Which one of the following could correctly set the behavior I have configured in the config file. Please note that I extend ServiceHostFactory class and override the CreateServiceHost(String, Uri[]) method.
var host = new ServiceHost(typeof(MyConcreteService), baseAddresses);
var host = base.CreateServiceHost(typeof(MyConcreteService), baseAddresses);
Please help and thanks.
Upvotes: 1
Views: 1544
Reputation: 62504
Both should be working fine since you define a configuration for service type by specifying its interface type and no matter how host was created.
Upvotes: 1