posts - 50, comments - 168, trackbacks - 6

My Links

News



View Marcin Celej's profile on LinkedIn

Archives

Post Categories

Wednesday, November 07, 2007

Checking if WCF service is configured in your app.config

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)
     return;

host.Open();

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.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Wednesday, November 07, 2007 7:18 AM | Feedback (0) |

Powered by: