This blog is about developing Windows applications using Visual Studio. All postings on this weblog are provided "AS IS" with no warranties, and confer no rights. Use of any samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
Your host Nikola Dudar is a Program Manager in Windows division of Microsoft Corporation. He has been working on Windows Web Services API during Windows 7 and various additions to Visual C++ during VS2005 and VS2008. More details are in LinkedIn profile under Nikola's formal name Mykola Dudar.
If you are interested in program management and project management, check out my other blog at http://www.pmsnack.com/ where I collect best practices and other topics interesting to program and project managers.
To send feedback, comments or requests for new posts, please use the contact form.
While I was playing with Microsoft AdCenter API, I have encountered this error:
Error 'An endpoint configuration section for contract 'Microsoft.AdCenter.ICampaignManagementService' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.' encountered.
Out of curiosity, I searched the web for guidance to troubleshoot this error. Surprisingly, I have found very confusing posts of forums with no clear guidance on how to fix the problem. However there seems to be a very simple solution in VS2008 SP1, unless I am missing something.
That's it. In my example, the app.config file looked like this:
Now I was going to use HTTPS connection to the service and as such I am choosing to use "BasicHttpBinding_ICampaignManagementService" binding, which means modifying source code from:
svcCampMgt = new CampaignManagementServiceClient();
to
svcCampMgt = new CampaignManagementServiceClient("BasicHttpBinding_ICampaignManagementService");
This change complete fixes the problem. Now some WCF guru can probably point out several other reasons for this error, but hey, for simple scenarios, this change should fix the error just fine.
Hi, thanks for the solution.
This is why this error occurs:
Visual Studio generates the end points in the app.config when you refresh your service reference. If your end point has been modified inside the app.config file it creates a second end point, and that is what causes the problem.
So to fix this, simply select the one you want to keep, look in the <basicHttpBinding> node of the file, and delete everything between <binding.name...> and </binding>, you'll notice that you have two of those, only delete one of them.
Do the same for the <Client> node of the file.
Unfortunately Visual Studion will generate that code everytime you update the service reference, so you'll have to remove it again every time.
Your solution is the best one in this case, and if you deliberately have two endpoint, eg. to include one for over http etc.
Cheers!
Thank you so much. I had no idea how to find out what the endpoint names ...
usally means that you to refrences in your web.config..Good Luck