Link to home
Start Free TrialLog in
Avatar of Dangeriz
DangerizFlag for Taiwan, Province of China

asked on

WCF Session Timeout

Hi All,

I'm doing load testing on WCF and would like to know the fundamentals of WCF sessions and their timeout criteria. I have configured the InstanceContextMode to "PerSession" and have left the MaxConcurrentSessions on default (10) and then hosted the WCF Service in IIS 7.0. The results of the load tests show that 10 WCF calls were made and then any subsequent calls failed with a timeout exception. This seems to be normal behavior.

When do those sessions timeout? I thought it may be 20 minutes (since IIS's sessions are by default set to that value), but after being inactive for over an hour, I re-run the load test and all WCF calls still fail, indicating that those initial 10 sessions are still being utilized. Only an IISRESET will allow me to free up those sessions.

Does WCF sessions have their own timeout values? Or do they depend on the protocol's session? Can session timeouts be configured on the WCF service? Also, if both WCF and the protocol have session timeouts, then which one takes preference?

Dave
Avatar of Reza Rad
Reza Rad
Flag of New Zealand image

could you paste the code section of client when use wcf?
and then i will help you on this issue
Avatar of Dangeriz

ASKER

Ok. Let me setup the environment again (this was done a while ago). Once I reproduce it, I'll send you the code. What exactly do you need? The code of the WCF service? or the app.config file?
the code you used wcf in your client,
let me bring a sample for you:
http://geekswithblogs.net/marcel/archive/2007/05/01/112159.aspx

you should close your proxy class after using it
I'm actually using the WCF Load Test tool from codeplex.
Below is the code from the client application.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace ConsoleClient
{
    class Program
    {
        static void Main(string[] args)
        {
            ChannelFactory<IService1> factory = new ChannelFactory<IService1>("netTcpEP");
            IService1 proxy = factory.CreateChannel();

            proxy.RunCalculations(100000);
        }
    }
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dangeriz
Dangeriz
Flag of Taiwan, Province of China image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial