I'm having trouble adding ServiceReference, it usually adds but when it generates the "Client" class it encounters the following error:
No endpoints compatible with Silverlight 3 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.
In the creation of .svc I selected the new item with compatibility for Silverlight. I have also tried to change the project windows phone to version 8.1 Silverlight but also to no avail. I have read in some tutorials that this could be a VS bug, but also that it had already been fixed (ie, I may have the version of something outdated, but I'm with VS2015).
When inserting a new .svc and running it empty, it works out, the problem starts to appear when I insert methods that return ; the strange thing is that the first time I created a WCF project I did the same process and it worked, I tried to insert this project (what worked) in the solution and it also did not work in this case.
.SVC :
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class CargaInicial : ICargaInicial
{
LojaService _lojaService = new LojaService();
UsuarioService _usuarioService = new UsuarioService();
ProdutoService _produtoService = new ProdutoService();
public Loja ObterLoja()
{
return _lojaService.ObterLoja();
}
public List<Usuario> ObterUsuarios()
{
return this._usuarioService.ObterUsuarios();
}
public List<Produto> ObterProdutos()
{
return _produtoService.ObterTodosProdutos();
}
}
Interface :
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class CargaInicial : ICargaInicial
{
LojaService _lojaService = new LojaService();
UsuarioService _usuarioService = new UsuarioService();
ProdutoService _produtoService = new ProdutoService();
public Loja ObterLoja()
{
return _lojaService.ObterLoja();
}
public List<Usuario> ObterUsuarios()
{
return this._usuarioService.ObterUsuarios();
}
public List<Produto> ObterProdutos()
{
return _produtoService.ObterTodosProdutos();
}
}
When I inserted the reference I used the following settings :
ProductClass:
[Table("Produto")]
public class Produto : Entity<Guid>, IProduto
{
[Required]
public string Codigo { get; set; }
[Required]
public string Descricao { get; set; }
[Required]
public decimal PrecoVenda { get; set; }
[Required]
public DateTime DataHoraUltimaAtualizacao { get; set; }
}
This class is from another project in the same solution. I have tried to insert the DataContract> and [DataMemberContract] but still failed.
Maybe a solution is to change the version of Silverlight in the project, but I do not know how to do that and I also have to use version 8.0 as it's a requirement. p>