C#程序运行中,最后会出现“无法写入远程计算机中的性能计数器”,是什么原因
private void InitializeComponent()
{
this.performanceCounterBytesSentTotal = new System.Diagnostics.PerformanceCounter();
this.performanceCounterBytesSentPerSec = new System.Diagnostics.PerformanceCounter();
this.performanceCounterRequestsTotal = new System.Diagnostics.PerformanceCounter();
this.performanceCounterRequestsPerSec = new System.Diagnostics.PerformanceCounter();
this.timer = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentTotal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentPerSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsTotal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsPerSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.timer)).BeginInit();
//
// performanceCounterBytesSentTotal
//
this.performanceCounterBytesSentTotal.CategoryName = "Quote Service Counts";
this.performanceCounterBytesSentTotal.CounterName = "# of Bytes sent";
this.performanceCounterBytesSentTotal.MachineName = "cnagel";
this.performanceCounterBytesSentTotal.ReadOnly = false;
//
// performanceCounterBytesSentPerSec
//
this.performanceCounterBytesSentPerSec.CategoryName = "Quote Service Counts";
this.performanceCounterBytesSentPerSec.CounterName = "# of Bytes sent / sec";
this.performanceCounterBytesSentPerSec.MachineName = "cnagel";
this.performanceCounterBytesSentPerSec.ReadOnly = false;
//
// performanceCounterRequestsTotal
//
this.performanceCounterRequestsTotal.CategoryName = "Quote Service Counts";
this.performanceCounterRequestsTotal.CounterName = "# of Requests";
this.performanceCounterRequestsTotal.MachineName = "cnagel";
this.performanceCounterRequestsTotal.ReadOnly = false;
//
// performanceCounterRequestsPerSec
//
this.performanceCounterRequestsPerSec.CategoryName = "Quote Service Counts";
this.performanceCounterRequestsPerSec.CounterName = "# of Requests / sec";
this.performanceCounterRequestsPerSec.MachineName = "cnagel";
this.performanceCounterRequestsPerSec.ReadOnly = false;
//
// timer
//
this.timer.Enabled = true;
this.timer.Interval = 1200000;
this.timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
//((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentTotal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentPerSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsTotal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsPerSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.timer)).EndInit(); }
private void InitializeComponent()
{
this.performanceCounterBytesSentTotal = new System.Diagnostics.PerformanceCounter();
this.performanceCounterBytesSentPerSec = new System.Diagnostics.PerformanceCounter();
this.performanceCounterRequestsTotal = new System.Diagnostics.PerformanceCounter();
this.performanceCounterRequestsPerSec = new System.Diagnostics.PerformanceCounter();
this.timer = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentTotal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentPerSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsTotal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsPerSec)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.timer)).BeginInit();
//
// performanceCounterBytesSentTotal
//
this.performanceCounterBytesSentTotal.CategoryName = "Quote Service Counts";
this.performanceCounterBytesSentTotal.CounterName = "# of Bytes sent";
this.performanceCounterBytesSentTotal.MachineName = "cnagel";
this.performanceCounterBytesSentTotal.ReadOnly = false;
//
// performanceCounterBytesSentPerSec
//
this.performanceCounterBytesSentPerSec.CategoryName = "Quote Service Counts";
this.performanceCounterBytesSentPerSec.CounterName = "# of Bytes sent / sec";
this.performanceCounterBytesSentPerSec.MachineName = "cnagel";
this.performanceCounterBytesSentPerSec.ReadOnly = false;
//
// performanceCounterRequestsTotal
//
this.performanceCounterRequestsTotal.CategoryName = "Quote Service Counts";
this.performanceCounterRequestsTotal.CounterName = "# of Requests";
this.performanceCounterRequestsTotal.MachineName = "cnagel";
this.performanceCounterRequestsTotal.ReadOnly = false;
//
// performanceCounterRequestsPerSec
//
this.performanceCounterRequestsPerSec.CategoryName = "Quote Service Counts";
this.performanceCounterRequestsPerSec.CounterName = "# of Requests / sec";
this.performanceCounterRequestsPerSec.MachineName = "cnagel";
this.performanceCounterRequestsPerSec.ReadOnly = false;
//
// timer
//
this.timer.Enabled = true;
this.timer.Interval = 1200000;
this.timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
//((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentTotal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterBytesSentPerSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsTotal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.performanceCounterRequestsPerSec)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.timer)).EndInit(); }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货