I have WCF service developed with .NET 4.0 In behavior I have this throttling element:
<behavior name="Test">
<serviceThrottling maxConcurrentInstances="1000"/>
</behavior>
As I know according to this: WCF 4: Default Throttling Settings for WCF Services
MaxConcurrentSessions: default is 100 * ProcessorCount MaxConcurrentCalls: default is 16 * ProcessorCount
On my PC I have Environment.ProcessorCount = 2
I then added code that reads config of these two values, since I didn't add values explicitly I expect them to be default.
How I check it from Global.asax:
protected void Application_Start(object sender, EventArgs e)
{
var config = WebConfigurationManager.OpenWebConfiguration("/TestDefaults");
var bindings = BindingsSection.GetSection(config);
var group = ServiceModelSectionGroup.GetSectionGroup(config);
foreach (ServiceBehaviorElement behavior in group.Behaviors.ServiceBehaviors)
{
if (behavior.Name == "Test")
{
var th = ((ServiceThrottlingElement)behavior.Where(el => el is ServiceThrottlingElement).FirstOrDefault());
if (th != null)
{
File.AppendAllText(Server.MapPath("~/Result.txt"),
String.Format("MaxConcurrentCalls {0} MaxConcurrentSessions {1}",
th.MaxConcurrentCalls,
th.MaxConcurrentSessions));
}
}
}
}
Result is:
MaxConcurrentCalls 16 MaxConcurrentSessions 100
Now I'm a bit confused, what are defaults? Could be that this check is not correct? Thanks in advance.