none
Default Value of MaxConcurrentInstances - 26 or Int32.MaxValue RRS feed

Answers

  • However, once the MaxConcurrentInstances property is accessed (get is called), if MaxConcurrentInstances isn't set already, it's reinitialized by the property itself:

     

        public int MaxConcurrentInstances
        {
            get

            {
                if (!this.maxInstanceSetExplicitly)
                {
                    this.instances = this.calls + this.sessions;
                    if (this.instances < 0)
                    {
                        this.instances = 0x7fffffff;
                    }
                }
                return this.instances;
            }
            set
            {
                if (value <= 0)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString("SFxThrottleLimitMustBeGreaterThanZero0")));
                }
                this.instances = value;
                this.maxInstanceSetExplicitly = true;
            }
        }

    So, I think the documentation is wrong, here.  Once you create a ServiceThrottlingBehavior, the instances is int.MaxValue.  However, once that value is accessed through the class's property, it becomes 26 (with no changes to calls and sessions).  I'll file a doc bug for this.

     

    -James

    Tuesday, April 29, 2008 11:12 PM
    Moderator

All replies

  •  

    If you reflect the System.ServiceModel.dll WCF assembly and look at the ServiceThrottlingBehaviour class, you will be able to see that the default value for MaxConcurrentInstances is 0x7FFFFFFF (int.MaxValue).

     

    Code Snippet
    public ServiceThrottlingBehavior()
    {    
        this.calls = 0x10;    
        this.sessions = 10;    
        this.instances = 0x7fffffff;
    }
     
    Note that the best .NET Reflector tool for reverse engineering code that I have come across, can be downloaded for free from Lutz Roeder's Website at:-
     
    Dave
    Friday, April 25, 2008 7:54 AM
  • However, once the MaxConcurrentInstances property is accessed (get is called), if MaxConcurrentInstances isn't set already, it's reinitialized by the property itself:

     

        public int MaxConcurrentInstances
        {
            get

            {
                if (!this.maxInstanceSetExplicitly)
                {
                    this.instances = this.calls + this.sessions;
                    if (this.instances < 0)
                    {
                        this.instances = 0x7fffffff;
                    }
                }
                return this.instances;
            }
            set
            {
                if (value <= 0)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString("SFxThrottleLimitMustBeGreaterThanZero0")));
                }
                this.instances = value;
                this.maxInstanceSetExplicitly = true;
            }
        }

    So, I think the documentation is wrong, here.  Once you create a ServiceThrottlingBehavior, the instances is int.MaxValue.  However, once that value is accessed through the class's property, it becomes 26 (with no changes to calls and sessions).  I'll file a doc bug for this.

     

    -James

    Tuesday, April 29, 2008 11:12 PM
    Moderator