Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WCF and WF
  4. When to close WCF client?

When to close WCF client?

Scheduled Pinned Locked Moved WCF and WF
questioncsharpwcfcom
2 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MBursill
    wrote on last edited by
    #1

    When is it a good time to close a WCF client? Straight from MSDN: http://msdn.microsoft.com/en-us/library/ms751519.aspx[^] It shows:

    CalculatorClient client = new CalculatorClient();

    followed by a bunch of calls to the client, and lastly...

    //Closing the client releases all communication resources.
    client.Close();

    What I really want to know is if it's an okay practice to keep a client open for long periods of time, possibly indefinitely? The reason I would want to do this is because I call a method on my service named "AuthenticateUser" and later I wish to call "GetAuthenticatedUser". If I use the same client object, my returned User object is persisted (without the need to implement a stateful service). I'm having a hard time finding information on what is and isn't good practice when it comes to WCF, specifically on the client side. -Mike.

    M 1 Reply Last reply
    0
    • M MBursill

      When is it a good time to close a WCF client? Straight from MSDN: http://msdn.microsoft.com/en-us/library/ms751519.aspx[^] It shows:

      CalculatorClient client = new CalculatorClient();

      followed by a bunch of calls to the client, and lastly...

      //Closing the client releases all communication resources.
      client.Close();

      What I really want to know is if it's an okay practice to keep a client open for long periods of time, possibly indefinitely? The reason I would want to do this is because I call a method on my service named "AuthenticateUser" and later I wish to call "GetAuthenticatedUser". If I use the same client object, my returned User object is persisted (without the need to implement a stateful service). I'm having a hard time finding information on what is and isn't good practice when it comes to WCF, specifically on the client side. -Mike.

      M Offline
      M Offline
      mohit raghav
      wrote on last edited by
      #2

      did u find the answer for it??? s26f84 at gmail d0t com thanks

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups