An endpoint configuration section for contract 'xxx' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name

Last post 11-06-2009 2:40 PM by ewgoforth. 1 replies.

Sort Posts:

  • An endpoint configuration section for contract 'xxx' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name

    11-05-2009, 4:17 PM
    • Member
      34 point Member
    • ewgoforth
    • Member since 06-18-2007, 9:33 PM
    • Posts 79

    Hello,

    I'm trying to test calling a webservice, I've found several free ones on http://webserviceshare.com, but none of them work for me.  Some of them give example calling code in C# which I've translated to VB.NET, they're typically just two to four lines, I don't think I've translated them incorrectly.

    On that I've tried is US Zip Validator.  I added a Service Reference to http://www.webservicemart.com/uszip.asmx?WSDL, called ZipService.

    I then call it like so:



                Dim myZipService As ZipService.USZipSoapClient = New ZipService.USZipSoapClient()
                Dim myCity As String = myZipService.ValidateZip("27707")


    I get the following error on the first line of code:

    "An endpoint configuration section for contract 'ZipService.USZipSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name."


    A page with information on this web service (including C# source code) is at:

    http://webserviceshare.com/Reference/Directories/Phones-Addresses/WsdlService/US-Zip-Validator/ValidateZip.htm

    Some of the other ones on webserviceshare.com that I've tried are the AustralianPostCodeSoapClient and the GetUKLocationByCounty, but they all fail with a similar error on the constructor.

    Any idea what I'm doing wrong?

    -Eric

  • Re: An endpoint configuration section for contract 'xxx' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name

    11-06-2009, 2:40 PM
    Answer
    • Member
      34 point Member
    • ewgoforth
    • Member since 06-18-2007, 9:33 PM
    • Posts 79

    Hello,


    In the thread at http://servicefactory.codeplex.com/Thread/View.aspx?ThreadId=25485, I found: 

    --------------------------------------------

    Did you try something like this?


    MyClientProxy proxy = new MyClientProxy("endpoint name");


    Where "endpoint name" should be pointing to one of your endpoints (name attr) in client config file.

    --------------------------------------------

    I looked at the app.config file and found:


    <endpoint address="http://www.webservicemart.com/uszip.asmx"
                    binding="basicHttpBinding" bindingConfiguration="USZipSoap"
                    contract="ZipService.USZipSoap" name="USZipSoap" />
                <endpoint address="http://www.webservicemart.com/uszip.asmx"
                    binding="customBinding" bindingConfiguration="USZipSoap12"
                    contract="ZipService.USZipSoap" name="USZipSoap12" />

    I changed my code to:


    Dim myZipService As ZipService.USZipSoapClient = New ZipService.USZipSoapClient("USZipSoap")
                Dim myCity As String = myZipService.ValidateZip("27707")

    and it worked!

    -Eric

Page 1 of 1 (2 items)