Visual studio 2012 使用VS 2012时性能计数器挂起+;IISExpress 8
几天后,我一直在尝试解决这个问题,所以我提出了一个测试用例:Visual studio 2012 使用VS 2012时性能计数器挂起+;IISExpress 8,visual-studio-2012,iis-express,performancecounter,Visual Studio 2012,Iis Express,Performancecounter,几天后,我一直在尝试解决这个问题,所以我提出了一个测试用例: 启动新的asp.net mvc项目 在HomeController上。索引将代码替换为 var测试=新性能计数器(“toto”、“cac”); 返回内容(“toto”) 确保已设置为使用IIS Express 在调试时启动项目 在我的机器上,它永远挂在PerformanceCounter线上。如果我按下停止按钮,我可以看到以下statcktrace: [Managed to Native Transition] mscorli
- 启动新的asp.net mvc项目
- 在HomeController上。索引将代码替换为 var测试=新性能计数器(“toto”、“cac”); 返回内容(“toto”)
- 确保已设置为使用IIS Express
- 在调试时启动项目
[Managed to Native Transition]
mscorlib.dll!Microsoft.Win32.RegistryKey.InternalGetValue(string name, object defaultValue, bool doNotExpand, bool checkSecurity) + 0x5ae bytes
mscorlib.dll!Microsoft.Win32.RegistryKey.GetValue(string name) + 0x29 bytes
System.dll!System.Diagnostics.PerformanceMonitor.GetData(string item) + 0x67 bytes
System.dll!System.Diagnostics.PerformanceCounterLib.GetPerformanceData(string item) + 0xbb bytes
System.dll!System.Diagnostics.PerformanceCounterLib.CategoryTable.get() + 0x6a bytes
System.dll!System.Diagnostics.PerformanceCounterLib.CounterExists(string category, string counter, ref bool categoryExists) + 0x1a bytes
System.dll!System.Diagnostics.PerformanceCounterLib.CounterExists(string machine, string category, string counter) + 0x4f bytes
System.dll!System.Diagnostics.PerformanceCounter.InitializeImpl() + 0x2eb bytes
System.dll!System.Diagnostics.PerformanceCounter.PerformanceCounter(string categoryName, string counterName, string instanceName, bool readOnly) + 0x98 bytes
System.dll!System.Diagnostics.PerformanceCounter.PerformanceCounter(string categoryName, string counterName) + 0x13 bytes
TestPerfCounter.dll!TestPerfCounter.Controllers.HomeController.Index()行17+0x21字节C#
有什么想法吗?如果我切换到development server,它不会挂起…我最终找到了一个解决方案: 我不知道为什么,但它解决了 重建基本性能计数器 可扩展计数器信息存储在以下两个文件中 位置:以下注册表子项: HKEY\U LOCAL\U MACHINE\Software\Microsoft\Windows NT\Current Version\Perflib\009%Systemroot%\System32\Perfc009.dat文件和 %Systemroot%\System32\Perfh009.dat文件以重建基础 手动执行性能计数器库,请执行以下步骤:展开 Perfc009.dat文件和Perfh009.dat文件。这些文件位于 在Windows安装光盘上。压缩文件可在以下位置找到: 驱动器号:\i386\perfc009.da_uu和驱动器号:\i386\perfh009.da_u。 替换%Systemroot%\System32文件夹中的文件。开始 注册表编辑器,然后在注册表中找到以下项: HKEY\ U本地\计算机\软件\ Microsoft\Windows NT\CurrentVersion\Perflib在注册表中,更改最后一个计数器 值设置为1846(十进制),并将最后一个帮助值更改为1847 (十进制)。找到以下注册表项以搜索服务 具有Performancesubkey的: HKEY\U LOCAL\U MACHINE\System\CurrentControlSet\Services删除 性能子项中的以下值(如果存在):第一个 计数器第一个帮助最后一个计数器最后一个帮助您也可以使用 Exctrlst.exe工具,用于定位性能计数器动态链接 安装的库文件(DLL),然后访问注册表 删除DWORD值。你现在有了一个可行的表现 仅包含系统基计数器的注册表 注意:从注册表中的性能子项中删除值 可能导致任何已安装的.NET Framework应用程序无法正常工作 下一次启动时。如果出现这种情况,请使用lodctr/R “重新添加可扩展计数器”部分中的命令来重建 性能计数器。如果开始时仍然有问题 对于.NET Framework应用程序,请参阅“重新安装任何自定义.NET” 本文中的“框架程序集性能计数器”部分