Skip to main content
The World's Best Known Brand for Microsoft Project and Project Server Expertise

Project Server Experts Community Site

Search
Project Server Experts Community Site
Project Server Help Blog
MSProject Experts
Training Schedule
Contact Us
  
Project Server Experts Community Site > Project Server FAQ KnowledgeBase > Set the Data Access Timeout in Project Server 2007  


Set the Data Access Timeout in Project Server 2007



Microsoft Project Server Frequently Asked Questions (FAQs): Overview



Microsoft Project Server Frequently Asked Questions (FAQs): Details

Background Description

When Project Server 2007 shipped, the data access layer timeout was hard-coded to 30 seconds. It became apparent early on that this was inadequate for some configurations. By SP1, Microsoft added the ability to reset the timeout value using a new PSI method:

Admin.SetDatabaseTimeout(DatabaseTimeoutType.Core, timeout);

Resolution

You can increase the Data Layer timeout using the above PSI method. Below is the code for a command line tool to set the timeout value:

using System;
using System.Collections.Generic;
using System.Text;

using PsDbTimeout.PsiAdmin;

namespace PsDbTimeout
{
    public class PsDbTimeout
    {
        private const string ADMIN_PSI_PAGE = "admin.asmx";
        private const int DEFAULT_DB_TIMEOUT = 30; // in seconds

        static public int Main(string[] args)
        {
            // Validation
            if (args.Length < 1 || args[0] == "/?" || args[0] == "-?")
            {
                PrintUsage(true);
                return 1;
            }

            try
            {
                PrintUsage(false);
                System.Console.WriteLine("ProjectServer URL: " + args[0]);
                string psiurl = GetPsiRootUrl(args[0]);
                bool isupdate = false;
                int timeout = 0;

                if (args.Length > 1)
                {
                    isupdate = true;
                    if (!int.TryParse(args[1], out timeout)
                        || timeout < DEFAULT_DB_TIMEOUT)
                    {
                        System.Console.WriteLine(string.Format("Error:
provide valid database timeout (in seconds, greater than or equal to {0}).",
DEFAULT_DB_TIMEOUT));
                        return 1;
                    }
                }

                Admin adminPsi = GetAdminPsi(psiurl);

                if (isupdate)
                {
                    System.Console.WriteLine(string.Format("Updating core
database timeout setting to {0} seconds ...", timeout));
                    adminPsi.SetDatabaseTimeout(DatabaseTimeoutType.Core,
timeout);
                    System.Console.WriteLine("Done.");
                }
                else
                {
                    System.Console.WriteLine("Reading current core database
timeout setting ...");
                    timeout =
adminPsi.GetDatabaseTimeout(DatabaseTimeoutType.Core);
                    System.Console.WriteLine(string.Format("Current core
database timeout setting: {0} seconds.", timeout));
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Error: " + ex.Message);
            }

            return 0;
        }


        static private void PrintUsage(bool includeDescription)
        {
            System.Console.WriteLine("ProjectServer DatabaseTimeout
Utility");
            System.Console.WriteLine("Reads / updates core database timeout
setting on ProjectServer instance.");
            System.Console.WriteLine();

            if (includeDescription)
            {
                System.Console.WriteLine("Usage: ");
                System.Console.WriteLine(System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName
+ " psurl <timeout>");
                System.Console.WriteLine("Parameters: ");
                System.Console.WriteLine("  psurl - ProjectServer URL");
                System.Console.WriteLine("  timeout - new database timeout
setting (in seconds) for specified ProjectServer instance. If this parameter
is not specified, utility reads current database timeout setting.");
            }
        }


        static private string GetPsiRootUrl(string psurl)
        {
            string url = psurl;

            // Cleanup
            if (!(url.StartsWith("http://") || url.StartsWith("https://")))
                url = "http://" + url;
            if (!url.EndsWith("/"))
                url = url + "/";

            // Additional validation
            Uri uri = new Uri(url);

            url += "_vti_bin/psi/";

            return url;
        }


        static private Admin GetAdminPsi(string psiurl)
        {
            Admin adminPsi = new Admin();
            adminPsi.UseDefaultCredentials = true;
            adminPsi.Url = psiurl + ADMIN_PSI_PAGE;

            return adminPsi;
        }
    }
}

 

Stay Connected

Join Our
LinkedIn Network
Follow Us
on Twitter

About FAQs

Microsoft Project Server Frequently Asked Questions (FAQs) provide information about Microsoft Project Server 2002, Microsoft Project Server 2003, Microsoft Project Server 2007, and Microsoft Project Server 2010.

Topics include common errors and the Project Server queue, project manager and resource manager approvals, enterprise calendars, enterprise custom fields, enterprise projects and the enterprise resource pool, user access, reports and OLAP analysis, resource work, project costing, task progress reporting and timesheets, Project Web Access (PWA) and Project Professional, check-out check-in and the local cache, saving and publishing, and issues risks deliverables documents and project workspaces.

About This Site

Project Server Experts (www.projectserverexperts.com) is an online community that provides answers to Project Server Frequently Asked Questions, allows members of the Project Server community to connect with one another by uploading their Business Cards, provides links to online Project Server resources, and links to Microsoft Project and Project Server related jobs.

This site is brought to you by MSProjectExperts. If you find the information posted here useful, please consider visiting our commercial site (www.msprojectexperts.com) for Project Server books, Project Server training and Project Server consulting services. Please support our sponsors. Thanks. -- The MSProjectExperts Team

Submissions

We welcome content submissions. We give author credit and cross link on all accepted articles. Please send your articles and suggestions to info(at)msprojectexperts.com.

Copyright

Reproduction of content on this site is strictly prohibited without the express permission of MSProjectExperts. Copyright (c) 2011 CHEFETZ LLC. All rights reserved