More than one endpoint configuration for that contract was found
some problems with web services that have more than one binding, i.e. designed to support Soap 1.0 and Soap 1.2.
This was the first sign of this nasty quirk;
An endpoint configuration section for contract ‘FreebieSMSWebservice.BulkSMSSoap’ could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
If you open the Configuration.svcinfo file, then scroll to the end right, you’ll see the xml (below). Where I’ve highlighted the endpoint names;
So then the client code becomes:
BulkSMSSoapClient SMS = new BulkSMSSoapClient("BulkSMSSoap");
double dCredit = SMS.GetRemainingCredit("xxxx", "xxxx");
MessageBox.Show(dCredit.ToString());
Where the parameter sent to the constructor is the endpoint name.
<?xml version="1.0" encoding="utf-8"?>
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
<behaviors />
<bindings>
<binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" messageEncoding="Text" name="BulkSMSSoap" textEncoding="utf-8" transferMode="Buffered"><readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192" /><security mode="None"><message algorithmSuite="Default" clientCredentialType="UserName" /><transport clientCredentialType="None" proxyCredentialType="None" realm="" /></security></Data>" bindingType="basicHttpBinding" name="BulkSMSSoap" />
<binding digest="System.ServiceModel.Configuration.CustomBindingElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="BulkSMSSoap12"><httpTransport allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" manualAddressing="false" maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" /><textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8"><readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192" /></textMessageEncoding></Data>" bindingType="customBinding" name="BulkSMSSoap12" />
</bindings>
<endpoints>
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="basicHttpBinding" bindingConfiguration="BulkSMSSoap" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="basicHttpBinding" bindingConfiguration="BulkSMSSoap" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap" />" contractName="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap" />
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="customBinding" bindingConfiguration="BulkSMSSoap12" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap12" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="customBinding" bindingConfiguration="BulkSMSSoap12" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap12" />" contractName="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap12" />
</endpoints>
</configurationSnapshot>