Hi All,
I was developing a WCF service that consume Bing Maps Geocode Serivce, and when i was trying to create an object from the geocodeservice, i was getting this error :
{"An endpoint configuration section for contract 'GeocodeService.IGeocodeService' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name."}
C# Code for creating a Geocode service object:
GeocodeServiceClient geocodeService = new GeocodeServiceClient();
This is beacause i have more than endpooint for my service, please check your Web.Config or the service configuration file if your WCF is not hosted within web application. You will find at least 2 endpoints are defined for your service, To fix the problem :
1) Either to remove one of the endpoints definition.
2) Keep all endpoints and select which endpoint you want to use in your code - This is the preferred solution.
C# Code for the fix : 2nd option
GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
I selected the basic HTTP binding for my service. and you can select any of your choice and you have to specify this in your code.
Hope this helps.
Regards,Mostafa Arafatwitter.com/mostafaelzoghbi
No comments:
Post a Comment