Increase Timeout ‘Globally’ in RIA Services

I’ve been trying to raise the timeout of our RIA project globally. After hours of struggling with trying to do it on the WCF web.config setting (WCF config is really not my strongest suit), I’ve decided to implement a code-approach solution instead. If anyone knows how to configure this within web.config, please give me a shout šŸ™‚

1. Go to the project that have WCF Ria Services Link (if you forget which project it is, you can find this out easily by checking the properties of each project).

2. Enable “Show All Files” in “Solution Explorer”.

3. Navigate to the Generated_Code Folder and find the projectname.g.cs file and open it.

4. Find the namespace and the class name of the domain context (i.e its assumed as RandomContext for this post).

5. Create a new class in this project called RandomContext.cs.

6. Append this code to the class (change the domain context name/project name/namespace to theĀ appropriateĀ name first and change the namespan as necessary):

namespace RandomServices.Web
    public sealed partial class RandomContext : DomainContext
        partial void OnCreated()
            TimeSpan timeSpan = new TimeSpan(0, 1, 0, 0);
            if (!DesignerProperties.IsInDesignTool)
                   SendTimeout = timeSpan;
                    ReceiveTimeout = timeSpan;
                    OpenTimeout = timeSpan;
                    CloseTimeout = timeSpan;


PS: The difference between each timeouts are as follow (taken from

Client side:

  • SendTimeout is used to initialize the OperationTimeout, which governs the whole interaction for sending a message (including receiving a reply message in a request-reply case).Ā  This timeout also applies when sending reply messages from a CallbackContract method.
  • OpenTimeout and CloseTimeout are used when opening and closing channels (when no explicit timeout value is passed).
  • ReceiveTimeout is not used.

Server side:

  • Send, Open, and Close Timeout same as on client (for Callbacks).
  • ReceiveTimeout is used by ServiceFramework layer to initialize the session-idle timeout.

One comment

  1. Klaus · · Reply

    Thx, this works fine!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: