简体   繁体   中英

HttpRuntime..cctor takes forever to execute

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?

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?

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 ".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM