对于以下代码,我得到
System.ComponentModel.Win32Exception:找不到网络路径
任何人都可以帮忙吗?
PerformanceCounter pc = new PerformanceCounter("System",
"System Up Time");
pc.MachineName = "1.2.3.4";
//Normally starts with zero. do Next Value always.
pc.NextValue();
TimeSpan ts = TimeSpan.FromSeconds(pc.NextValue());
Response.Write("This system 1.2.3.4 has been up for " + ts.Days + " days " + ts.Hours + " hours, " + ts.Minutes + " and " + ts.Seconds +" seconds.");
编辑:我尝试使用机器名称,但我仍然得到同样的错误!注:1.2.3.4 为样本值。