The lifetime of an instance of a WCF service?

后端 未结 4 1062
南方客
南方客 2021-01-05 12:03

in the process of creating a WCF service I ran into a term that\'s new to me. Basically when specifying the InstanceContextMode I have a few options, including;

4条回答
  •  自闭症患者
    2021-01-05 12:28

    It means that only one instance of your class is created by WCF. All requests are handled by that instance. Multithreading and concurrency issues included.

    Although it would probably be an implementation detail, I doubt your class is persistet (it would have to be serializable for that, which is not a requirement). The one instance simply exists as long as it is needed (i.e. the associated ServiceHost is open).

提交回复
热议问题