Dica: Acessando ServiceReference em Class Library com C#
Problema:
Ao tentar acessar web service registrado em Class Library obtive o seguinte erro:
Could not find default endpoint element that references contract….
Solução:
EndpointAddress endpointAddress = new EndpointAddress("HTTP://endereco.com/service.asmx"); BasicHttpBinding binding1 = new BasicHttpBinding(BasicHttpSecurityMode.None); var servico = new ServiceTeste.ServiceSoapClient(binding1, endpointAddress);
Dessa forma Endpoint e o Binding padrão do serviço serão criados dinamicamente.
Fonte: C# & ASP.Net – Kishore Gorjala: WCF Client without app.config/web.config
http://csharpaspnet.blogspot.com/2009/01/wcf-client-without-appconfigwebconfig.htm