Jim,
Thanks for the information, I couldn't have solved my problem without your help and that link you gave me.
For anyone else interested, you will have to do the following to make this project work:
(Side note: this was all done in Visual studio 2010 Professional, .NET 3.5 framework)
1. Correct the type mismatches. In the WcfPox solution, you can look in the IOrderingService.cs file to see how the service is implemented (e.g., the Quantity member of the Item class is an int, and should be treated so in the Program.cs file within the PoxClient solution).
2. There is also a variable name mismatch. The IOrderingService defines the the OrderConfirmation class to return string data member titled orderId , however there are several locations in the Program.cs file (within the PoxClient solution) that refer to it as OrderId with a capital O. Correct either Program.cs or the IOrderingService interface definition.
3. I never had a problem with Environment.MachineName , but as Jim suggested you should consider changing baseAddress string to use 127.0.0.1 instead of Environment.MachineName if you are experiencing issues.
4. Most importantly, you need to add the following public static void Main() method to the OrderingService class in your OrderingService.cs file (within the WcfPox solution).
// Host the service within this EXE console application.
public static void Main()
{
using (ServiceHost serviceHost = new ServiceHost(typeof(OrderingService)))
{
try
{
// Open the ServiceHost to start listening for messages.
serviceHost.Open();
// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.ReadLine();
// Close the ServiceHost.
serviceHost.Close();
}
catch (TimeoutException timeProblem)
{
Console.WriteLine(timeProblem.Message);
Console.ReadLine();
}
catch (CommunicationException commProblem)
{
Console.WriteLine(commProblem.Message);
Console.ReadLine();
}
}
}
I am surprised the authors left this out of their code example.... This was the key to making everything work. As Jim suggested, you actually need to start the service!
5. Add a reference to the System.configuration dll.
6. Open each solution with administrator privileges. Not sure if this matters for the client solution, but you will need admin rights to start your WCF service. First, start your WcfPox solution because this is the actual service that will open the port for listening. Then, run your PoxClient solution. Should be good.