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
LVL 4
DangerizAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Reza RadConsultant, TrainerCommented:
could you paste the code section of client when use wcf?
and then i will help you on this issue
0
DangerizAuthor Commented:
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?
0
Reza RadConsultant, TrainerCommented:
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
0
DangerizAuthor Commented:
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

0
DangerizAuthor Commented:
I found out that the session timeout value can be configured via the "ReceiveTimeout" property on the binding: http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding.receivetimeout.aspx.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.