码迷,mamicode.com
首页 > 其他好文 > 详细

<转>WCF实例化模式与高并发处理

时间:2015-01-23 08:19:30      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

WCF实例化模式与高并发控制

1.实例化模式InstanceModel

1.1 PerCall:单调模式

    每次调用都会产生一个实例

    例[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)]

 

1.2 PerSession会话模式   

    每次调用都有同一个服务进行处理

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)]

 

1.3 SingleTon 单例模式    

    多个请求,只有一个实例

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]

 

 

2.并发控制

在服务行为里设置

<serviceThrottling

   maxConcurrentCalls="1000"         //最大并发请求消息数量

   maxConcurrentInstances="1000"     //最大并发服务实例的数量

   maxConcurrentSessions="1000" />   //最大并发会话连接数

 

 

技术分享
<behaviors>
  <serviceBehaviors>
      <behavior name="WCFService.WCFServiceBehavior">
         <serviceMetadata httpGetEnabled="false"/>
         <serviceDebug includeEXceptionDetilInfaults="false"/>
         <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessins="100" maxConcurrentInstances="1000"/>
      </behavior>
  </serviceBehaviors>
</behaviors>
View Code

 

<转>WCF实例化模式与高并发处理

标签:

原文地址:http://www.cnblogs.com/chcong/p/4243172.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!