这是创建性能计数器的代码:
var ftpPerfCounter = new PerformanceCounter("FTP Service", "Current Connections", "_Total");
这就是例外发生的地方:
int cnt = (int)Math.Round(ftpPerfCounter.NextValue());
s 这里的 Expeption
消息 :
"Error Message: The Counter layout for the Category specified is invalid, a counter of the type: AverageCount64, AverageTimer32, CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, CounterMultiTimer100NsInverse, RawFraction, or SampleFraction has to be immediately followed by any of the base counter types: AverageBase, CounterMultiBase, RawBase or SampleBase."
错误信息是相当隐秘的。 我不知道今后能做些什么来避免例外。
详细
This happens on Windows Server 2008 R2 64-bit OS. The FTP Server is IIS.