title: Startup application is not able to find the endpoint configuration for client WCF Service
body: <p>I have a ServiceLibrary Application(Host) - LTService which is the starting point of my application. Its contract accepts three arguments username, password and xmlstring. After authenticating it, I am validating and deserializing xmlstring. Now I have one another ServiceLibrary Application(Host) - WCFServiceDialler in the same solution for moment. It accepts a username, password and the object that I have got from the process of deserializing xml above.</p>
  
  <p>I am making my client to consume the DiallerService in another web application prj - partnercontract where I am adding the service reference and it can find the contract that WCFServiceDialler expose. But when I run the following code:</p>
  
  <pre><code>&gt; LeadTransfer.PartnerContracts.DiallerServiceReference.DiallerClient
  &gt; client = new
  &gt; LeadTransfer.PartnerContracts.DiallerServiceReference.DiallerClient("wsHttpBinding");
  &gt;         WCFServiceDialler.DiallerData diallerData = new WCFServiceDialler.DiallerData();
  &gt;         diallerData.Username = "xxxx";
  &gt;         diallerData.Password = "xxx";
  &gt;         DiallerServiceReference.CarLeadDO temp = new DiallerServiceReference.CarLeadDO();
  &gt;         diallerData.carLeadDO = (DiallerServiceReference.CarLeadDO)Convert.ChangeType(tempDataMediator,
  &gt; typeof(DiallerServiceReference.CarLeadDO));
  &gt;         client.DiallerProcess(diallerData);
  </code></pre>
  
  <p>The first statement throws an exception that </p>
  
  <blockquote>
    <p>Could not find endpoint element with name 'wsHttpBinding' and contract 'DiallerServiceReference.IDialler' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.</p>
  </blockquote>
  
  <p>I am not able to figure out that what it is not able to find the endpoint. My startup applications are both the WCF Service projects above.</p>
  
  <p>Following is the wsdl definition in my client service applciation:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Service" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt;
    &lt;wsp:Policy wsu:Id="WSHttpBinding_IDialler_policy"&gt;
      &lt;wsp:ExactlyOne&gt;
        &lt;wsp:All&gt;
          &lt;sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;wsp:Policy&gt;
              &lt;sp:ProtectionToken&gt;
                &lt;wsp:Policy&gt;
                  &lt;sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt;
                    &lt;wsp:Policy&gt;
                      &lt;sp:RequireDerivedKeys /&gt;
                      &lt;sp:BootstrapPolicy&gt;
                        &lt;wsp:Policy&gt;
                          &lt;sp:SignedParts&gt;
                            &lt;sp:Body /&gt;
                            &lt;sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                            &lt;sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                            &lt;sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                            &lt;sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                            &lt;sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                            &lt;sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                            &lt;sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
                          &lt;/sp:SignedParts&gt;
                          &lt;sp:EncryptedParts&gt;
                            &lt;sp:Body /&gt;
                          &lt;/sp:EncryptedParts&gt;
                          &lt;sp:SymmetricBinding&gt;
                            &lt;wsp:Policy&gt;
                              &lt;sp:ProtectionToken&gt;
                                &lt;wsp:Policy&gt;
                                  &lt;sp:SpnegoContextToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt;
                                    &lt;wsp:Policy&gt;
                                      &lt;sp:RequireDerivedKeys /&gt;
                                    &lt;/wsp:Policy&gt;
                                  &lt;/sp:SpnegoContextToken&gt;
                                &lt;/wsp:Policy&gt;
                              &lt;/sp:ProtectionToken&gt;
                              &lt;sp:AlgorithmSuite&gt;
                                &lt;wsp:Policy&gt;
                                  &lt;sp:Basic256 /&gt;
                                &lt;/wsp:Policy&gt;
                              &lt;/sp:AlgorithmSuite&gt;
                              &lt;sp:Layout&gt;
                                &lt;wsp:Policy&gt;
                                  &lt;sp:Strict /&gt;
                                &lt;/wsp:Policy&gt;
                              &lt;/sp:Layout&gt;
                              &lt;sp:IncludeTimestamp /&gt;
                              &lt;sp:EncryptSignature /&gt;
                              &lt;sp:OnlySignEntireHeadersAndBody /&gt;
                            &lt;/wsp:Policy&gt;
                          &lt;/sp:SymmetricBinding&gt;
                          &lt;sp:Wss11&gt;
                            &lt;wsp:Policy /&gt;
                          &lt;/sp:Wss11&gt;
                          &lt;sp:Trust10&gt;
                            &lt;wsp:Policy&gt;
                              &lt;sp:MustSupportIssuedTokens /&gt;
                              &lt;sp:RequireClientEntropy /&gt;
                              &lt;sp:RequireServerEntropy /&gt;
                            &lt;/wsp:Policy&gt;
                          &lt;/sp:Trust10&gt;
                        &lt;/wsp:Policy&gt;
                      &lt;/sp:BootstrapPolicy&gt;
                    &lt;/wsp:Policy&gt;
                  &lt;/sp:SecureConversationToken&gt;
                &lt;/wsp:Policy&gt;
              &lt;/sp:ProtectionToken&gt;
              &lt;sp:AlgorithmSuite&gt;
                &lt;wsp:Policy&gt;
                  &lt;sp:Basic256 /&gt;
                &lt;/wsp:Policy&gt;
              &lt;/sp:AlgorithmSuite&gt;
              &lt;sp:Layout&gt;
                &lt;wsp:Policy&gt;
                  &lt;sp:Strict /&gt;
                &lt;/wsp:Policy&gt;
              &lt;/sp:Layout&gt;
              &lt;sp:IncludeTimestamp /&gt;
              &lt;sp:EncryptSignature /&gt;
              &lt;sp:OnlySignEntireHeadersAndBody /&gt;
            &lt;/wsp:Policy&gt;
          &lt;/sp:SymmetricBinding&gt;
          &lt;sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;wsp:Policy /&gt;
          &lt;/sp:Wss11&gt;
          &lt;sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;wsp:Policy&gt;
              &lt;sp:MustSupportIssuedTokens /&gt;
              &lt;sp:RequireClientEntropy /&gt;
              &lt;sp:RequireServerEntropy /&gt;
            &lt;/wsp:Policy&gt;
          &lt;/sp:Trust10&gt;
          &lt;wsaw:UsingAddressing /&gt;
        &lt;/wsp:All&gt;
      &lt;/wsp:ExactlyOne&gt;
    &lt;/wsp:Policy&gt;
    &lt;wsp:Policy wsu:Id="WSHttpBinding_IDialler_DiallerProcess_Input_policy"&gt;
      &lt;wsp:ExactlyOne&gt;
        &lt;wsp:All&gt;
          &lt;sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;sp:Body /&gt;
            &lt;sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
          &lt;/sp:SignedParts&gt;
          &lt;sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;sp:Body /&gt;
          &lt;/sp:EncryptedParts&gt;
        &lt;/wsp:All&gt;
      &lt;/wsp:ExactlyOne&gt;
    &lt;/wsp:Policy&gt;
    &lt;wsp:Policy wsu:Id="WSHttpBinding_IDialler_DiallerProcess_output_policy"&gt;
      &lt;wsp:ExactlyOne&gt;
        &lt;wsp:All&gt;
          &lt;sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;sp:Body /&gt;
            &lt;sp:Header Name="To" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="From" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="ReplyTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="MessageID" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="RelatesTo" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
            &lt;sp:Header Name="Action" Namespace="http://www.w3.org/2005/08/addressing" /&gt;
          &lt;/sp:SignedParts&gt;
          &lt;sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
            &lt;sp:Body /&gt;
          &lt;/sp:EncryptedParts&gt;
        &lt;/wsp:All&gt;
      &lt;/wsp:ExactlyOne&gt;
    &lt;/wsp:Policy&gt;
    &lt;wsdl:types&gt;
      &lt;xsd:schema targetNamespace="http://tempuri.org/Imports"&gt;
        &lt;xsd:import schemaLocation="http://localhost:56435/Service.svc?xsd=xsd0" namespace="http://tempuri.org/" /&gt;
        &lt;xsd:import schemaLocation="http://localhost:56435/Service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /&gt;
        &lt;xsd:import schemaLocation="http://localhost:56435/Service.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/WCFServiceDialler" /&gt;
        &lt;xsd:import schemaLocation="http://localhost:56435/Service.svc?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/LeadTransfer.DiallerData.DataContracts.Car.Aviva" /&gt;
      &lt;/xsd:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="IDialler_DiallerProcess_InputMessage"&gt;
      &lt;wsdl:part name="parameters" element="tns:DiallerProcess" /&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="IDialler_DiallerProcess_OutputMessage"&gt;
      &lt;wsdl:part name="parameters" element="tns:DiallerProcessResponse" /&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:portType name="IDialler"&gt;
      &lt;wsdl:operation name="DiallerProcess"&gt;
        &lt;wsdl:input wsaw:Action="http://tempuri.org/IDialler/DiallerProcess" message="tns:IDialler_DiallerProcess_InputMessage" /&gt;
        &lt;wsdl:output wsaw:Action="http://tempuri.org/IDialler/DiallerProcessResponse" message="tns:IDialler_DiallerProcess_OutputMessage" /&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
    &lt;wsdl:binding name="WSHttpBinding_IDialler" type="tns:IDialler"&gt;
      &lt;wsp:PolicyReference URI="#WSHttpBinding_IDialler_policy" /&gt;
      &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /&gt;
      &lt;wsdl:operation name="DiallerProcess"&gt;
        &lt;soap12:operation soapAction="http://tempuri.org/IDialler/DiallerProcess" style="document" /&gt;
        &lt;wsdl:input&gt;
          &lt;wsp:PolicyReference URI="#WSHttpBinding_IDialler_DiallerProcess_Input_policy" /&gt;
          &lt;soap12:body use="literal" /&gt;
        &lt;/wsdl:input&gt;
        &lt;wsdl:output&gt;
          &lt;wsp:PolicyReference URI="#WSHttpBinding_IDialler_DiallerProcess_output_policy" /&gt;
          &lt;soap12:body use="literal" /&gt;
        &lt;/wsdl:output&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name="Service"&gt;
      &lt;wsdl:port name="WSHttpBinding_IDialler" binding="tns:WSHttpBinding_IDialler"&gt;
        &lt;soap12:address location="http://localhost:56435/Service.svc/ws" /&gt;
        &lt;wsa10:EndpointReference&gt;
          &lt;wsa10:Address&gt;http://localhost:56435/Service.svc/ws&lt;/wsa10:Address&gt;
          &lt;Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity"&gt;
            &lt;Upn&gt;Pandeysi@cis.ad.capita.co.uk&lt;/Upn&gt;
          &lt;/Identity&gt;
        &lt;/wsa10:EndpointReference&gt;
      &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>Configuration for first LTService Application:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;services&gt;
    &lt;service behaviorConfiguration="http" name="TestCDLWCF.Service"&gt;
      &lt;endpoint address="wstest" binding="wsHttpBinding" contract="TestCDLWCF.ILeadTransfer"&gt;
        &lt;identity&gt;
          &lt;dns value="localhost" /&gt;
        &lt;/identity&gt;
      &lt;/endpoint&gt;
      &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;
          &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/TestCDLWCF/Service1/" /&gt;
        &lt;/baseAddresses&gt;
      &lt;/host&gt;
    &lt;/service&gt;
    &lt;service name="WCFServiceDialler.Service"&gt;
      &lt;endpoint address="ws" binding="wsHttpBinding" bindingConfiguration=""
        contract="WCFServiceDialler.IDialler" /&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;
          &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/WCFServiceDialler/Service/mex" /&gt;
        &lt;/baseAddresses&gt;
      &lt;/host&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="http"&gt;
        &lt;serviceMetadata httpGetEnabled="true" /&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
      &lt;/behavior&gt;
      &lt;behavior&gt;
        &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
      &lt;/behavior&gt;
  
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Configuration for WCFServiceDialler application:</p>
  
  <pre><code>    &lt;system.serviceModel&gt;
      &lt;bindings&gt;
        &lt;wsHttpBinding&gt;
          &lt;binding name="binding" /&gt;
        &lt;/wsHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;services&gt;
        &lt;service name="WCFServiceDialler.Service"&gt;
          &lt;endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="binding"
            contract="WCFServiceDialler.IDialler" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/WCFServiceDialler/Service/mex" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="true"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Configuration in my project that consumes wcfdiallerservice:</p>
  
  <pre><code> &lt;system.serviceModel&gt;
      &lt;bindings&gt;
          &lt;wsHttpBinding&gt;
              &lt;binding name="WSHttpBinding_IDialler" closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                  allowCookies="false"&gt;
                  &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                      maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                  &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"
                      enabled="false" /&gt;
                  &lt;security mode="Message"&gt;
                      &lt;transport clientCredentialType="Windows" proxyCredentialType="None"
                          realm="" /&gt;
                      &lt;message clientCredentialType="Windows" negotiateServiceCredential="true"
                          algorithmSuite="Default" /&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
              &lt;binding name="WSHttpBinding_IDialler1" closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                  bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                  messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                  allowCookies="false"&gt;
                  &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                      maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
                  &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"
                      enabled="false" /&gt;
                  &lt;security mode="Message"&gt;
                      &lt;transport clientCredentialType="Windows" proxyCredentialType="None"
                          realm="" /&gt;
                      &lt;message clientCredentialType="Windows" negotiateServiceCredential="true"
                          algorithmSuite="Default" /&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
          &lt;/wsHttpBinding&gt;
      &lt;/bindings&gt;
      &lt;client&gt;
          &lt;endpoint address="http://localhost/Service.svc/ws" binding="wsHttpBinding"
              bindingConfiguration="WSHttpBinding_IDialler" contract="WCFServiceDialler.IDialler"
              name="WSHttpBinding_IDialler"&gt;
              &lt;identity&gt;
                  &lt;servicePrincipalName value="host/CIDDTS4FCMG4.cis.ad.capita.co.uk" /&gt;
              &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="http://localhost:56435/Service.svc/ws" binding="wsHttpBinding"
              bindingConfiguration="WSHttpBinding_IDialler1" contract="DiallerServiceReference.IDialler"
              name="WSHttpBinding_IDialler1"&gt;
          &lt;/endpoint&gt;
      &lt;/client&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>