sábado, 26 de septiembre de 2015

An endpoint configuration section for contract 'Srv1.Ws2Soap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name. at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard) at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName) at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName) at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)



Una vez mas aqui despues de algun tiempo,

En esta ocasion veremos este mensaje de error al invocar un web services,

An endpoint configuration section for contract 'Srv1.Ws2Soap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.    at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)    at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)    at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)    at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) 



Este error puede ocurrir cuando tenemos diferentes endpoint invocando al mismo Web services,

Para evitar este molestoso mensaje tenemos que indicarle el nombre del endpoint que lo encontramos en el web services cliente

Por ejemplo

<endpoint address="http://localhost/ERP/App_Compras/Servicio/WsCompras.asmx"
                binding="customBinding" bindingConfiguration="WsComprasSoap121"
                contract="SrvCompras.WsComprasSoap" name="WsComprasSoap121" />


    SrvComprasWsComprasSoapClient oSrvComprasSoapClient = new SrvComprasWsComprasSoapClient ("WsComprasSoap121");


Saludos