HttpRuntime..cctor takes forever to execute

212 Views Asked by At

Dead simple code:

using System;
using System.Diagnostics;
using System.Web;
using System.Web.Caching;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Stopwatch sw = Stopwatch.StartNew();
            Cache cache = HttpRuntime.Cache;
            Console.WriteLine(sw.Elapsed.ToString());
            Console.ReadLine();
        }
    }
}

And I've already been waiting for output for over 5 minutes. This problem started to manifest itself about a week ago (may be less) and three more computers (my coworkers' boxes) experience the same behavior, except that some of them manage to initialize HttpRuntime in under a minute, which is still very weird.

Has anybody experienced that? And what do I do with it?

2

There are 2 best solutions below

0
On

I'd use some of the SysInternals tools to work out what it's doing - whether it's trying to make network connections etc. Process Monitor will show you file and registry access; TCPView will show you what ports it's got open. (You might want to use WireShark to monitor what it's doing too.)

Is this running locally, or on a UNC path?

0
On

Check out Mark "SysInternals" Russinovich's blog about possible approaches if simpler steps don't show anything. Interesting entries include "The Case of the Delayed Windows Vista File Open Dialogs" and "The Case of the Slooooow System".