943,923 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 3170
  • ASP.NET RSS
Aug 10th, 2009
0

Call to WCF timeout on the second call

Expand Post »
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:

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

Implementation:

vb Syntax (Toggle Plain Text)
  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),

vb Syntax (Toggle Plain Text)
  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!
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
culebrin is offline Offline
62 posts
since Aug 2007
Aug 10th, 2009
0

Re: Call to WCF timeout on the second call

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

ASP.NET Syntax (Toggle Plain Text)
  1. DirectCast(service, IContextChannel).OperationTimeout = New TimeSpan(0, 0, 240)

Refer: http://www.codeproject.com/KB/WCF/WC..._Timeout_.aspx
Reputation Points: 165
Solved Threads: 113
Posting Pro
Ramesh S is offline Offline
580 posts
since Jun 2009
Aug 12th, 2009
0

Re: Call to WCF timeout on the second call

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:

xml Syntax (Toggle Plain Text)
  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

Click to Expand / Collapse  Quote originally posted by Ramesh S ...
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

ASP.NET Syntax (Toggle Plain Text)
  1. DirectCast(service, IContextChannel).OperationTimeout = New TimeSpan(0, 0, 240)

Refer: http://www.codeproject.com/KB/WCF/WC..._Timeout_.aspx
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
culebrin is offline Offline
62 posts
since Aug 2007
Aug 12th, 2009
0

Re: Call to WCF timeout on the second call

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.
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
culebrin is offline Offline
62 posts
since Aug 2007
Aug 19th, 2009
0

Re: Call to WCF timeout on the second call

Well, Someone might wanna know this...

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

Click to Expand / Collapse  Quote originally posted by culebrin ...

vb Syntax (Toggle Plain Text)
  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...
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
culebrin is offline Offline
62 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: ASP.NET AJAX Slider "ontextchanged"
Next Thread in ASP.NET Forum Timeline: Populate textfields from a dropdown list box using datasource





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC