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
  1. Home
  2. General Programming
  3. WCF and WF
  4. WCF : Diffrence between Session and Instance

WCF : Diffrence between Session and Instance

Scheduled Pinned Locked Moved WCF and WF
csharpwcfquestion
3 Posts 2 Posters 0 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.
  • T Offline
    T Offline
    Tiger456
    wrote on last edited by
    #1

    What's the difference between a session and instance in WCF. Its life and Scope ?

    S 1 Reply Last reply
    0
    • T Tiger456

      What's the difference between a session and instance in WCF. Its life and Scope ?

      S Offline
      S Offline
      Steve Westbrook
      wrote on last edited by
      #2

      A session is a series of one or more communications between the service and a client, whereas an instance is an instance of the service class itself. When an instance is created is controlled by the InstanceContextMode parameter of the ServiceBehavior attribute. It is per call - that is, a new instance is created (and destroyed) every time a request is sent to the service; per session - a new instance for each session; or single, meaning that only one instancce of the service is ever created while it is running. Sessions in WCF != ASP .NET Sessions. I believe they have to be manually created and destroyed, although I've only ever used per-call service instances. Hope this helps.

      T 1 Reply Last reply
      0
      • S Steve Westbrook

        A session is a series of one or more communications between the service and a client, whereas an instance is an instance of the service class itself. When an instance is created is controlled by the InstanceContextMode parameter of the ServiceBehavior attribute. It is per call - that is, a new instance is created (and destroyed) every time a request is sent to the service; per session - a new instance for each session; or single, meaning that only one instancce of the service is ever created while it is running. Sessions in WCF != ASP .NET Sessions. I believe they have to be manually created and destroyed, although I've only ever used per-call service instances. Hope this helps.

        T Offline
        T Offline
        Tiger456
        wrote on last edited by
        #3

        Thanks for your valuable reply. Which has a clear and exact answer to the question

        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