Call to WCF timeout on the second call

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Aug 2007
Posts: 56
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Call to WCF timeout on the second call

 
0
  #1
Aug 10th, 2009
Hi,

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:
Interface:

  1. <ServiceContract()> _
  2. Public Interface IRepositorio
  3.  
  4. <OperationContract(Name:="ListarAlmacen")> _
  5. Function ListarAlmacen() As List(Of BE.Almacen)
  6.  
  7. End Interface

Implementation:

  1. <AspNetCompatibilityRequirementsAttribute(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
  2. <ServiceBehavior(UseSynchronizationContext:=True, InstanceContextMode:=InstanceContextMode.PerSession, ConcurrencyMode:=ConcurrencyMode.Multiple)> _
  3. Public Class Repositorio
  4. Implements IRepositorio
  5.  
  6. Public Function ListarAlmacen() As List(Of BE.Almacen) Implements IRepositorio.ListarAlmacen
  7. Dim result As List(Of BE.Almacen)
  8. result = BL.Repositorio.Almacen.listar()
  9. Return result
  10. End Function
  11.  
  12. End Class

and on the client (a ASP.NET website, added the ServiceReference on the project),

  1. 'some code ...
  2.  
  3. Dim oAlmacenWCF As New repositorio.RepositorioClient
  4. Dim oListaAlmacenBE As List(Of BE.Almacen)
  5. oListaItemAlmacenBE = oAlmacenWCF.ListarAlmacen(item_id)
  6.  
  7. '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...

Thanks!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 439
Reputation: Ramesh S will become famous soon enough Ramesh S will become famous soon enough 
Solved Threads: 82
Ramesh S Ramesh S is offline Offline
Posting Pro in Training

Re: Call to WCF timeout on the second call

 
0
  #2
Aug 10th, 2009
Set the timeout properties of WCF application to increase the default timeout. This can be done on the client side programmically or with a client side App.Config or a Web.config.

You can configure the OperationTimeout property for Proxy in the WCF client code.

For example

  1. DirectCast(service, IContextChannel).OperationTimeout = New TimeSpan(0, 0, 240)

Refer: http://www.codeproject.com/KB/WCF/WC..._Timeout_.aspx
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 56
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Re: Call to WCF timeout on the second call

 
0
  #3
Aug 12th, 2009
Hi Ramesh,

Thank you very much for the answer, I've been looking how to do it in the web.config (i have a website client, and I want to do it in the web.config), but have no luck...

This is my first try ... and I'm not quit sure if I have the concepts right.

My proxy is generated with the vs2008 with the option "Add Service Reference..."

My client web.config has:

  1. <system.serviceModel>
  2. <bindings>
  3. <wsHttpBinding>
  4. <binding name="WSHttpBinding_IRepositorio" closeTimeout="00:01:00"
  5. openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
  6. bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
  7. maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
  8. textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
  9. <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
  10. maxBytesPerRead="4096" maxNameTableCharCount="16384" />
  11. <reliableSession ordered="true" inactivityTimeout="00:10:00"
  12. enabled="false" />
  13. <security mode="Message">
  14. <transport clientCredentialType="Windows" proxyCredentialType="None"
  15. realm="" />
  16. <message clientCredentialType="Windows" negotiateServiceCredential="true"
  17. algorithmSuite="Default" establishSecurityContext="true" />
  18. </security>
  19. </binding>
  20. </wsHttpBinding>
  21. </bindings>
  22. <client>
  23. <endpoint address="http://localhost:7604/Repositorio.svc" binding="wsHttpBinding"
  24. bindingConfiguration="WSHttpBinding_IRepositorio" contract="repositorio.IRepositorio"
  25. name="WSHttpBinding_IRepositorio">
  26. <identity>
  27. <dns value="localhost" />
  28. </identity>
  29. </endpoint>
  30. </client>
  31. </system.serviceModel>

And I'm not sure where to put the OperationTimeout property.

Thanks.

Omar

Originally Posted by Ramesh S View Post
Set the timeout properties of WCF application to increase the default timeout. This can be done on the client side programmically or with a client side App.Config or a Web.config.

You can configure the OperationTimeout property for Proxy in the WCF client code.

For example

  1. DirectCast(service, IContextChannel).OperationTimeout = New TimeSpan(0, 0, 240)

Refer: http://www.codeproject.com/KB/WCF/WC..._Timeout_.aspx
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 56
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Re: Call to WCF timeout on the second call

 
0
  #4
Aug 12th, 2009
Another thing. The method time span is long enough (the default timeout value is 60 secs) to execute it (it's just a query of one table), and I have no idea why, when executes the first time, it works, and the second time it didn't.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 56
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Re: Call to WCF timeout on the second call

 
0
  #5
Aug 19th, 2009
Well, Someone might wanna know this...

I solved the problem putting the close method at the end of the call.

Originally Posted by culebrin View Post

  1. 'some code ...
  2.  
  3. Dim oAlmacenWCF As New repositorio.RepositorioClient
  4. Dim oListaAlmacenBE As List(Of BE.Almacen)
  5. oListaItemAlmacenBE = oAlmacenWCF.ListarAlmacen(item_id)
  6. [COLOR="Red"]oAlmacenWCF.Close()[/COLOR]
  7.  
  8. 'some code
I hope this helps someone...
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC