MaxConnections standard bindings and throttling

Throttling and the standard bindings inside the Indigo CTP allow you to
set and control the maximum number of connections coming into the
system.  This is only settable on a few of the standard bindings,
like NetProfileNamedPipeBinding and NetProfileTcpBinding, however the
default value for these is 10.  So if you are using these bindings
and expect your web servive to get much activity you should increase
the number.

These bindins also play a part in how security works, security sets up
a second parallel connections so if you set your MaxConnections to be 1
and try to connect to the service with a secure channel, it will
timeout and not connect.

To set the max connections on the bindings is quite easy, you just do this:

NetProfileTcpBinding frog = new NetProfileTcpBinding();

frog.MaxConnections = 30;

To set the MaxConnections on the host when you setup the ServiceHost
class you access the Throttling property and set connection inside

ServiceHost<MyService> womble = new ServiceHost<MyService>();

womble.Throttling.MaxConnections = 30;

The throttling value for the MaxConnections property defaults to
MaxInt, so it is more likely you will see constraints from the binding
themselves than you will from the throttling, unless you setup the
throttling yourself of course.

Throttling is done at the ServiceModel level of the system while
the bindings are actually down at the channel level, so they tend to
operate slightly differently than the ServiceHost throttling. The
MaxConnections on the service host is also across all the possible
endpoints associated with that service, not just the specific one the
binding is aimed at.

Comments (0)