.net - How can I get WCF MSMQ to get more then 10 messages at a time? -
i've programmatically set msmq binding , throttling, though specify maxconcurrentcalls, maxconcurrentsessions , maxconcurrentinstances higher 10 don't manage process more 10 messages @ time.
here code create host:
var host = new servicehost(typeof(mqprocessrequestserver)); var binding = new netmsmqbinding(netmsmqsecuritymode.none) { usesourcejournal = true, receiveerrorhandling = receiveerrorhandling.drop, receiveretrycount = 0, maxretrycycles = 0, retrycycledelay = timespan.fromminutes(1), exactlyonce = true, durable = true, maxreceivedmessagesize = 4000000000, receivetimeout = timespan.fromseconds(30) }; var queueuri = string.format("net.msmq://localhost/private/{0}", scriptengineversion); host.addserviceendpoint(typeof(imqprocessrequest), binding, queueuri); // set throttling scriptengine.capacity in datamodel var throttling = new servicethrottlingbehavior { maxconcurrentcalls = capacity, maxconcurrentsessions = capacity, maxconcurrentinstances = capacity }; host.description.behaviors.add(throttling); // set service timeout var behavior = host.description.behaviors.find<servicebehaviorattribute>(); behavior.transactiontimeout = timespan.fromseconds(60).tostring();
here service behaviour:
[servicebehavior(concurrencymode = concurrencymode.multiple, instancecontextmode = instancecontextmode.percall, releaseserviceinstanceontransactioncomplete = false)] public class mqprocessrequestserver : imqprocessrequest, idisposable
i've tried different values capacity, less 10 works fine, in @ configured, above 10 10.
the 10 connections you're allowed caused default on servicepointmanager.defaultconnectionlimit
.
in notes section on msdn documentation on setting says:
when used in server environment (asp.net) defaultconnectionlimit defaults higher number of connections, 10.
in none server environment default 2.
to allow more connections set @ application start, when appdomain loads, defaultconnectionlimit.
servicepointmanager.defaultconnectionlimit = 100;
above line should allow 100 connections.
Comments
Post a Comment