I'm building my first WCF web service using .net 4.5.1(a web site...not an application). When I test on my local machine I can add the service reference to a project and actually use the methods. No errors at all.
I've configured the site using the "Simplified" configuration
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<!--<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>-->
<serviceMetadata httpGetEnabled="true"/>
<!-- 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 -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
After publishing the site to Azure I can add the service reference and it all appears to work fine. I can see that my methods are available in my service client object. When I test the program that uses one of the methods I get this error saying I have multiple endpoints and that I need to call them by name:
An endpoint configuration section for contract 'ServiceReference1.IService' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
This is the offending line of code:
ServiceReference1.ServiceClient mysrv = new ServiceReference1.ServiceClient();
It sounds like I've got to add an endpoint name:
ServiceReference1.ServiceClient mysrv = new ServiceReference1.ServiceClient("my-endpoint-name");
Since the simplified configuration creates the endpoint names automatically I don't know what name to use. I can't find any code samples showing how this is done.
Any help would be much appreciated,
James