I'm trying to consume a service but gives the error:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll
And the message:
"Could not find the default endpoint element which refers to the contract 'ServicoEmpresa.RemoteService' in configuration section of the ServiceModel client. This may have occurred due to the lack of a configuration file for your application or because no endpoint element corresponding to this contract could be found in the client element. "
Is this a problem in app.config?
Client file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_IEmpresaServicoRemoto" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8733/Design_Time_Addresses/PontoCerto.ServicoRemoto/EmpresaServicoRemoto/"
binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IEmpresaServicoRemoto"
contract="PontoCerto.ServicoRemoto.Contratos.IEmpresaServicoRemoto" name="BasicHttpBinding_IEmpresaServicoRemoto" />
</client>
<behaviors>
</behaviors>
</system.serviceModel>
</configuration>"
Arquivo do serviço:
>'<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<system.web>
<compilation debug="true" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="CustomMessage" type="PontoCerto.ServicoRemoto.Infraestrutura.CustomBehaviorExtensionElement, PontoCerto.ServicoRemoto,
 Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<services>
<service name="PontoCerto.ServicoRemoto.Servico.Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/PontoCerto.ServicoRemoto/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="PontoCerto.ServicoRemoto.Contratos.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="PontoCerto.ServicoRemoto.Servicos.EmpresaServicoRemoto">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/PontoCerto.ServicoRemoto/EmpresaServicoRemoto/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="wsHttpBinding"
contract="PontoCerto.ServicoRemoto.Contratos.IEmpresaServicoRemoto"
behaviorConfiguration="ClientEndpointBehavior">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="ClientEndpointBehavior">
<CustomMessage />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>