如何让webservice服务端只有一个实例和每会话一个实例

baiyunyinv 2010-08-02 11:59:31
如题!
...全文
129 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
baiyunyinv 2010-08-07
  • 打赏
  • 举报
回复
再顶起来。
jianuMan 2010-08-05
  • 打赏
  • 举报
回复
没用过 wcf
baiyunyinv 2010-08-05
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 jianuman 的回复:]
public sealed class Singleton {
static Singleton instance;
static object padlock = new object();

public Singleton() {
}

public static Singleton Instance {
get { ……
[/Quote]

没有像WCF那样,给一个特性的属性赋值?
jianuMan 2010-08-04
  • 打赏
  • 举报
回复
public sealed class Singleton {
static Singleton instance;
static object padlock = new object();

public Singleton() {
}

public static Singleton Instance {
get {
lock (padlock) {
if (instance == null) {
instance = new Singleton();
}
}
return instance;
}
}
}
public sealed class Singleton {
static Singleton instance;
static object padlock = new object();

public Singleton() {
}

public static Singleton Instance {
get {
lock (padlock) {
if (instance == null) {
instance = new Singleton();
}
}
return instance;
}
}
}


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jianuMan/archive/2010/06/13/5670042.aspx
baiyunyinv 2010-08-03
  • 打赏
  • 举报
回复
wcf 对这个问题是很简单的,在服务头上的特性就能解决

问题是webservice不知道如何解决
happyrain2010 2010-08-03
  • 打赏
  • 举报
回复
wcf
shaowenjie 2010-08-03
  • 打赏
  • 举报
回复
使用单例模式,就是一个类永远只生成一个对象,在WEBSERVICE中的确是很好的方式。
这个你可以去MSDN搜索下singleton模式(貌似这样拼写的)
baiyunyinv 2010-08-03
  • 打赏
  • 举报
回复
没人知道???????????????????!!!!!!

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧