this is the service that I created:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace HelloIndigo
{
[ServiceContract(Namespace = "http://www.thatindigogirl.com/samples/2006/06")]
public interface IHelloIndigoService
{
[OperationContract]
string HelloIndigo();
}
public class HelloIndigoService:IHelloIndigoService
{
public string HelloIndigo()
{
return "Hello Indigo";
}
}
}
this is how i am hosting it:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace Host
{
class HostProgram
{
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(HelloIndigo.HelloIndigoService),
new Uri("http://localhost:8000/HelloIndigo")))
{
host.AddServiceEndpoint(typeof(HelloIndigo.IHelloIndigoService),
new BasicHttpBinding(), "HelloIndigoService");
Console.WriteLine("Press <enter> to exit the Host");
Console.ReadLine();
}
}
}
}
this is the code for the client:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace Client
{
class ClientProgram
{
[ServiceContract(Namespace = "http://www.thatindigogirl.com/samples/2006/06")]
public interface IHelloIndigoService
{
[OperationContract]
string HelloIndigo();
}
static void Main(string[] args)
{
EndpointAddress ep =
new EndpointAddress("http://localhost:8000/HelloIndigo/HelloIndigoService");
IHelloIndigoService proxy = ChannelFactory<ihelloindigoservice>.
CreateChannel(new BasicHttpBinding(), ep);
string s = proxy.HelloIndigo();
Console.WriteLine(s);
Console.WriteLine("Press <enter> to terminate Client.");
Console.ReadLine();
}
}
}
my application is running in windows 7 and it has 3 projects. The host application runs first then the client.
the host is working fine, meaning I get Press <enter> to exit the Host in host console window.
But when the client runs I get the EndpointNotFoundException in the cient code at
string s = proxy.HelloIndigo();
I am guessing maybe windows 7 has an added layer of security and I need to register a port 8000 for listening or something. I am not sure.
Your help is greatly appreciated.