An endpoint configuration section for contract "serviceReferenc.service" could not be loaded

场景:有一个WCF应用,添加服务引用后,自动生成一个app.config文件,当调用WCF时,它抛出一个错误:

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

 

解决方案:

  1. 打开app.config文件,你可以看到<client> 标签下有2 个endpoint (因为你的WCF配置文件里定义了2个endpoint, 如果在WCF 配置文件里删除一个endpoint, 此时添加服务引用后它将生成一个)

  

  

 

  2. 删除其中一个endpoint

原文地址:https://www.cnblogs.com/mystar/p/3458063.html