I a real newbie on WCF, and I want to implement a service that reads from a DB some data and returns generic lists of custom objects to the client.
So I implement the service like this:
<ServiceContract()> _ Public Interface IRepositorio <OperationContract(Name:="ListarAlmacen")> _ Function ListarAlmacen() As List(Of BE.Almacen) End Interface
<AspNetCompatibilityRequirementsAttribute(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _ <ServiceBehavior(UseSynchronizationContext:=True, InstanceContextMode:=InstanceContextMode.PerSession, ConcurrencyMode:=ConcurrencyMode.Multiple)> _ Public Class Repositorio Implements IRepositorio Public Function ListarAlmacen() As List(Of BE.Almacen) Implements IRepositorio.ListarAlmacen Dim result As List(Of BE.Almacen) result = BL.Repositorio.Almacen.listar() Return result End Function End Class
and on the client (a ASP.NET website, added the ServiceReference on the project),
'some code ... Dim oAlmacenWCF As New repositorio.RepositorioClient Dim oListaAlmacenBE As List(Of BE.Almacen) oListaItemAlmacenBE = oAlmacenWCF.ListarAlmacen(item_id) 'some code
So, my problem is that when I first call the ListarAlmacen method it works ok, but when I tried to call it a second time, it gave me a timeout exception, I tried to step into to debug it, the first time it works, the debug steps into it; but the second time, it didn't.
I just have no idea what's happening, I tried some tips, but no luck (service log, web.config hacks, etc.).
Please some can tell me where's is the problem or how can I know for sure where to look for the problem...