While Trying to consume a WCF service hosted in a windows service getting HTTP Get Error, No connection could be made because the target machine actively refused it.But when I host Same application in a console application its working fine. The issue is getting when application hosting in Windows service.Following code is using to host service.
protected override void OnStart(string[] args)
{
try
{
Uri baseAddress = new Uri("http://localhost:8080/AuditService/");
host = new ServiceHost(typeof(AuditService), baseAddress);
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
host.Description.Behaviors.Add(smb);
host.AddServiceEndpoint(typeof(IAuditService), new BasicHttpBinding(BasicHttpSecurityMode.None), baseAddress);
host.Open();
}
catch (Exception)
{
host.Abort();
}
}