Un-Error-ASP.NET:无法加载协定为“YlbService.MMSHServicesSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。

ylbtech-Error-ASP.NET:无法加载协定为“YlbService.MMSHServicesSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。 
1.返回顶部
1、

“/”应用程序中的服务器错误。


无法加载协定为“YlbService.MMSHServicesSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.InvalidOperationException: 无法加载协定为“YlbService.MMSHServicesSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。

源错误:

行 754:    public partial class MMSHServicesSoapClient : System.ServiceModel.ClientBase<WebApp66.YlbService.MMSHServicesSoap>, WebApp66.YlbService.MMSHServicesSoap {
行 755:        
行 756:        public MMSHServicesSoapClient() {
行 757:        }
行 758:        

源文件: C:UsersAdministratorsource eposSolution3WebApp66Connected ServicesYlbServiceReference.cs    行: 756

堆栈跟踪:

[InvalidOperationException: 无法加载协定为“YlbService.MMSHServicesSoap”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。]
   System.ServiceModel.Description.ConfigLoader.LookupChannel(ContextInformation configurationContext, String configurationName, ContractDescription contract, EndpointAddress address, Boolean wildcard, Boolean useChannelElementKind, ServiceEndpoint& serviceEndpoint) +463
   System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) +89
   System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) +129
   System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory() +12901039
   System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory() +19
   System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait) +18
   System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef() +368
   System.ServiceModel.ClientBase`1..ctor() +295
   WebApp66.YlbService.MMSHServicesSoapClient..ctor() in C:UsersAdministratorsource
eposSolution3WebApp66Connected ServicesYlbServiceReference.cs:756
   WebApp66.WebForm1.btnAttachmentInfo_Click(Object sender, EventArgs e) in C:UsersAdministratorsource
eposSolution3WebApp66WebForm1.aspx.cs:74
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9782378
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +204
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3062.0  
2、
2.返回顶部
1、解决方法
删除 Web.config 中多余的节点
1.1 删除前
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MMSHServicesSoap" />
      </basicHttpBinding>
      <customBinding>
        <binding name="MMSHServicesSoap12">
          <textMessageEncoding messageVersion="Soap12" />
          <httpTransport />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="http://10.246.132.39:8888/MMSHServices.asmx"
        binding="basicHttpBinding" bindingConfiguration="MMSHServicesSoap"
        contract="YlbtechService.MMSHServicesSoap" name="MMSHServicesSoap" />
      <endpoint address="http://10.246.132.39:8888/MMSHServices.asmx"
        binding="customBinding" bindingConfiguration="MMSHServicesSoap12"
        contract="YlbtechService.MMSHServicesSoap" name="MMSHServicesSoap12" />
    </client>
  </system.serviceModel>
</configuration>

1.2 删除后

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="MMSHServicesSoap" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://10.246.132.39:8888/MMSHServices.asmx"
        binding="basicHttpBinding" bindingConfiguration="MMSHServicesSoap"
        contract="YlbtechService.MMSHServicesSoap" name="MMSHServicesSoap" />
    </client>
  </system.serviceModel>
</configuration>
2、
3.返回顶部
 
4.返回顶部
 
5.返回顶部
 
 
6.返回顶部
 
warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/storebook/p/12068075.html