Sky, Thank you once more. You have read my mind.
However i am running into an issue:
Here is how i have modified the above code for the host and the client:
The host
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace ConsoleApplication1
{
class Program
{
private static void Main(string[] args)
{
const string endpointAddress = "net.tcp://localhost:8001/Service";
var baseAddress = new Uri(endpointAddress);
using (var host = new ServiceHost(typeof(FirstWcfService.Service), baseAddress))
{
host.AddServiceEndpoint(typeof(FirstWcfService.IService), new NetTcpBinding(), baseAddress);
host.Open();
}
Console.WriteLine("Sai");
Console.ReadLine();
}
}
}
The Client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
namespace ConsoleApplication2
{
class Program
{
private static void Main(string[] args)
{
const string endpointAddress = "net.tcp://localhost:8001/Service";
// this is the client code.. simply put this in another console app
using (var factory = new ChannelFactory<FirstWcfService.IService>(new NetTcpBinding(), endpointAddress))
{
FirstWcfService.IService channel = factory.CreateChannel();
//DateTime d = channel.GetDate();
string h = channel.Hello();
//Console.WriteLine(String.Format("It is {0}", d));
Console.WriteLine(String.Format("It is {0}", h));
}
//// end client code
}
}
}
The host runs fine, when the client is ran here is the exception i am getting:
Could not connect to net.tcp://localhost:8001/Service. The connection attempt lasted for a time span of 00:00:00.8899011. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8001.
Please let me know if you have any suggestions.
Thanks
N