添加性能计数器类别可将计算机挂起 [英] Add Performance Counter Category Hangs Computers

查看:71
本文介绍了添加性能计数器类别可将计算机挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从ASP.NET MVC应用程序(在Windows 8 x64 PC上使用VS 2012)添加性能计数器,但是我遇到的问题是,如果我检查类别是否存在或添加了新的性能计数器类别,则计算机会挂起

I am trying from a ASP.NET MVC Application (with VS 2012 on Windows 8 x64 PC) to add a Perfomance Counter but I have the problem that if I check the category exists or add a new Performance Counter Category the computer hangs

我的代码是:

namespace TestMvcCounter
{
  public class MvcApplication : System.Web.HttpApplication
  {
      protected void Application_Start()
      {
          AreaRegistration.RegisterAllAreas();

          WebApiConfig.Register(GlobalConfiguration.Configuration);
          FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          RouteConfig.RegisterRoutes(RouteTable.Routes);
          BundleConfig.RegisterBundles(BundleTable.Bundles);

          if (!PerformanceCounterCategory.Exists("MY_TEST"))
          {
              CounterCreationDataCollection ccdc = new CounterCreationDataCollection();
              ccdc.Add(new CounterCreationData() { CounterName = "# loops", CounterType = PerformanceCounterType.RateOfCountsPerSecond32 });

              PerformanceCounterCategory.Create("MY_TEST", "Test performance counter", PerformanceCounterCategoryType.MultiInstance, ccdc);
          }

      }
   }
}

以及代码到达此行的时间

and when the code reach this line

!PerformanceCounterCategory.Exists("MY_TEST")

系统挂起,没有任何异常或超时

the system hangs without any exception or timeout

您知道造成问题的原因是什么吗?

Do you know what could be that cause the issue?

推荐答案

经过深入搜索,我发现问题出在IIS Express 8上.

After a deep search I figured out the problem was IIS Express 8.

我试图取消安装并重新安装,但是没有用,然后我再次尝试安装并安装IIS Express 7.5,它可以正常工作

I tried to unistall it and re-install but didn't work, then I tried to unistall again and install the IIS Express 7.5 and it works

这篇关于添加性能计数器类别可将计算机挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆