views:

58

answers:

0

Hello,

We have a program calling xaml service via channel factory. The problem occurs when we try to call the service multiple times.

The error is : The open operation did not complete within the allotted timeout of 00:00:30. The time allotted to this operation may have been a portion of a longer timeout.

In xaml service web.config we set serviceThrottling.

When is set to 10 it dies after 10 successful calls when is set to 1000 it runs to 1000 and throw this exception. We do close channel after every call, we use only one channel factory (it also not work if we create new channel factory every time), we try to use one channel instance but it goes with the same error. Obviously something stay open but we can't figure out what it is.

Here is the code:

          NetTcpBinding binding = new NetTcpBinding();

         ChannelFactory<IService> channelFactory = new ChannelFactory<IService(binding, new EndpointAddress("net.tcp://localhost/Service.xamlx"));

        IService channel = null;

        for (int i = 0; i < 10000; i++)
        {


            channel = channelFactory.CreateChannel();
            string result = channel.ServiceMethod();

            try
            {

                ((IClientChannel)channel).Close();

            }
            catch (Exception e)
            {

                 ((IChannel)channel).Abort();

            }
        }