0

I have created a WCFLibrary which has :

   [OperationContract]
   string TestCall();

And my app.config has this :

  <endpoint address="" binding="wsHttpBinding" contract="TestWCF.ITestService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8732/Design_Time_Addresses/TestWCF/TestService/" />
      </baseAddresses>
    </host>

My Windowsservice has this :

   protected override void OnStart(string[] args)
    {
        host = new ServiceHost(typeof(TestWCF.TestService));
    }

Have compiled exe and installed it as a service everything is fine till this point.

Now I wanted to check this url from browser :

*http://localhost:8732/Design_Time_Addresses/TestWCF/TestService*

but due to some reasons I cant make a call to my WCF hosted in Windows Service, What might be went wrong am I missing anything ?

Suave Nti
  • 3,721
  • 11
  • 54
  • 78

1 Answers1

2
protected override void OnStart(string[] args)
{
    host = new ServiceHost(typeof(TestWCF.TestService));
    host.Open(); // :-)
}
burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
  • MyBad MyBad.. How can I miss this single line :D:D ..Thanks Legion ;) – Suave Nti Oct 04 '12 at 09:05
  • Legion one more question hope you dont mind ..how can I make this IP from my app.config as a dynamic one and should ship seperately with exe. – Suave Nti Oct 04 '12 at 09:21
  • you can use dns name or use overload serviceHost ctor `ServiceHost serviceHost = new ServiceHost(typeof(TestWCF.TestService), baseAddress);` – burning_LEGION Oct 04 '12 at 09:25