I have a WCF service -
public class DemoClass : IDemoClass
{
}
I can successfully host this WCF Service in another managed windows service. When the main service loads I start my WCF main service like this -
ServiceHost servHost = new ServiceHost(typeof(DemoClass));
servHost.Open();
I now want to be able to pass parameters to the WCF service when it starts so that I can pass something to it's constructor -
public class DemoClass
{
public DemoClass(string parameter)
{
//need to access the parameter value that is passed here.
}
}
ServiceHost does not allow me to do that. How can I achieve this?