• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1847
  • Last Modified:

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
0
Dangeriz
Asked:
Dangeriz
  • 3
  • 2
1 Solution
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now