none
Using WCF inside a Windows Service or a Thread RRS feed

  • Question

  • Hi,

    I am hosting a WCF service inside a Windows Service. However, it seems that I cant access the hosted service. I tried to create a console app and host it, it works. However, when I initialize the hosting inside a thread, it doesnt work.

    How can I host WCF service inside a Windows Service? or inside a thread?

        _host = new ServiceHost(typeof(ActivationService), new Uri("http://localhost:6666"));
                _host.Description.Behaviors.Add(new ServiceMetadataBehavior
                {
                    HttpGetEnabled = true
                });
                _host.AddServiceEndpoint(typeof(IActivationService), new BasicHttpBinding(), new Uri("http://localhost:6666"));
                _host.Open();
    It is inside another thread.

    Note, the _host field is class level variabel.

    Thursday, April 16, 2015 4:02 AM

Answers