Question

I am trying to implement scalable wcf solution found at NetFX Harmonics: Creating Streamlined, Simplified, yet Scalable WCF Connectivity

So my solution have 4 projects

  • Contact.Service (Service and Data Contracts)
  • Contact.ServiceImpl (HostFactory and Service itself)
  • Contact.ServiceHost (Web.config and Person.svc)
  • Contact.ServiceClient

Contact.ServiceClient have App.config and Program.cs which actually call service.

App.config

<configuration> 
  <appSettings>
    <add key="PersonServiceActiveEndpoint" value="PersonServiceBasicHttpBinding" />
  </appSettings>    
  <system.serviceModel>
    <client>
      <endpoint name="PersonServiceBasicHttpBinding"
                address="http://localhost:1031/Person.svc"
                binding="basicHttpBinding"
                contract="Contact.Service.IPersonService" />
    </client>
  </system.serviceModel>  
</configuration>

Program.cs

  BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
            EndpointAddress endpointAddress = new EndpointAddress("http://localhost:1031/Person.svc");
            IPersonService personService = new ChannelFactory<IPersonService>(basicHttpBinding, endpointAddress).CreateChannel();

            Person person = personService.GetPersonData("F488D20B-FC27-4631-9FB9-83AF616AB5A6");
            Console.WriteLine(person.FirstName);

When I try running this example exception is thrown:

There was no endpoint listening at http://localhost:1031/Person.svc that could accept the message. This is often caused by an incorrect address or SOAP action.

P.S. Person.svc is in my Contact.ServiceHost project

<%@ ServiceHost Service="Contact.Service.PersonService" %>

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top