views:

478

answers:

1

hello to all

I have develop a silverlight chat application. In a single window load more than one chat windows at same time and every chat windo create a new connection to wcf duplex service. But after every 10 chat windows it disconnect from wcf and work stuck off. Im code some for throttling option but they don't work. this is my code:-

public class PollingDuplexServiceHostFactory : ServiceHostFactoryBase
{
    public override ServiceHostBase CreateServiceHost(string constructorString,
        Uri[] baseAddresses)
    {
        return new PollingDuplexSimplexServiceHost(baseAddresses);
    }
 }

/// <summary>
/// PollingDuplexServiceHostFactory
/// </summary>
class PollingDuplexSimplexServiceHost : ServiceHost
{

    public PollingDuplexSimplexServiceHost(params System.Uri[] addresses)
    {
        InitializeDescription(typeof(JakayaChatService), new UriSchemeKeyedCollection(addresses));
        Description.Behaviors.Add(new ServiceMetadataBehavior());
        var throttle = Description.Behaviors.Find<ServiceThrottlingBehavior>();

        if (throttle == null)
        {
            throttle = new ServiceThrottlingBehavior
            {
                MaxConcurrentCalls = 1000,
                MaxConcurrentInstances = 1000,
                MaxConcurrentSessions = 1000
            };
            Description.Behaviors.Add(throttle);
        }


    }

    protected override void InitializeRuntime()
    {
        PollingDuplexBindingElement pdbe = new PollingDuplexBindingElement()
        {
            ServerPollTimeout = TimeSpan.FromSeconds(05),
            InactivityTimeout = TimeSpan.FromSeconds(3600)

        };

        // Add an endpoint for the given service contract.
        this.AddServiceEndpoint(
            typeof(IJakayaChatService),
            new CustomBinding(
                pdbe,
                new BinaryMessageEncodingBindingElement(),
                new HttpTransportBindingElement()),
                "");

        // Add a metadata endpoint.
        this.AddServiceEndpoint(
            typeof(IMetadataExchange),
            MetadataExchangeBindings.CreateMexHttpBinding(),
            "mex");

        base.InitializeRuntime();

    }
}
A: 

The 10 connection limit is commonly attributed to the operating system. Windows XP for example has a 10 connection limit, wheras server operating systems will allow for many more in a production environment. That said, the issue may be confined to your dev env, and go away when deployed to a higher end OS.

Notes From MS: For Windows XP Professional, the maximum number of other computers that are permitted to simultaneously connect over the network is ten. This limit includes all transports and resource sharing protocols combined. For Windows XP Home Edition, the maximum number of other computers that are permitted to simultaneously connect over the network is five. This limit is the number of simultaneous sessions from other computers the system is permitted to host. This limit does not apply to the use of administrative tools that attach from a remote computer.

IIS Conneciton Limits and Optimization http://blogs.msdn.com/david.wang/archive/2006/04/12/HOWTO-Maximize-the-Number-of-Concurrent-Connections-to-IIS6.aspx

PortageMonkey