Geeks With Blogs
Marcin Celej blog

When you need to startup WCF service conditionally - depending on your application configuration it is quite easy to achieve it by checking the ServiceHost.BaseAddresses collection. If your app.config file does not contain your service configured the collection will be empty. Here is the snippet:

ServiceHost host = new ServiceHost(typeof(MyService));
if (host.BaseAddresses.Count < 1)


Next time I will post how to plug-in service startup in your application startup with a plug-in model i described in my post Plugging-in application initialization code. Posted on Wednesday, November 7, 2007 7:18 AM | Back to top

Comments on this post: Checking if WCF service is configured in your app.config

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Marcin Celej | Powered by: