system.diagnostics

Calculating server uptime gives “The network path was not found”

南笙酒味 提交于 2020-01-04 05:38:23
问题 For the following code, I am getting System.ComponentModel.Win32Exception: The network path was not found Can anyone help? 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.");

Track System.Diagnostics.Trace logs in Azure portal

人盡茶涼 提交于 2020-01-04 05:35:12
问题 In my web application, I use System.Diagnostics.Trace.WriteLine(...); for diagnostics. The application is published to an Azure deployment slot. I am wondering where I can find these logs in the Azure Portal (or Visual Studio's cloud explorer). 回答1: You first need to activate the Application Logging: Go to your Web App. Go to Monitoring / Diagnostics logs . Enable Application Logging and configure it. This article can also be useful: https://stackify.com/azure-app-service-log-files/ 来源: https

How to Configure Network Tracing Dotnet core for HttpClient calls?

人走茶凉 提交于 2020-01-02 09:29:15
问题 As per reference document at https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-configure-network-tracing We can setup this in web.config or any other configuration file and we get detailed system.net traces, packets traces for HttpClient calls and any kind of issue in HttpClient calls can be captured in traces, be it certificate, TLS or anything else. However, do we have similar implementation for dotnet core / standard which can be used in both web app or console

System.Diaganostics.Process (when one process internally uses another)

夙愿已清 提交于 2020-01-01 18:55:13
问题 I've been using C# System.Diagnostics.Process to monitor the output of a command line utility. The process I'm monitoring "internally" launches a second process, and as soon as it does, I receive no further output from the process object. What's frustrating, is, if you execute the very same command (that I'm launching with the System.Diagnostics.Process object) with cmd.exe (manually), the console outputs every line I need to be seeing in my C# app! However, if I (for testing purposes) launch

System.Diaganostics.Process (when one process internally uses another)

泪湿孤枕 提交于 2020-01-01 18:55:06
问题 I've been using C# System.Diagnostics.Process to monitor the output of a command line utility. The process I'm monitoring "internally" launches a second process, and as soon as it does, I receive no further output from the process object. What's frustrating, is, if you execute the very same command (that I'm launching with the System.Diagnostics.Process object) with cmd.exe (manually), the console outputs every line I need to be seeing in my C# app! However, if I (for testing purposes) launch

Trace logs location, where to view them

元气小坏坏 提交于 2019-12-28 05:53:13
问题 Where do you see Trace.Write(""); logs while developing an MVC or WCF app? What is the correct place to look at? 回答1: When using the System.Diagnostics.Trace class, the Write method writes its trace output "to the trace listeners in the Listeners collection." The Trace.Listeners property by default only contains an instance of the DefaultTraceListener, which outputs messages to the debugger output window. To view those trace messages, you have to enable debugging, of course. So if you debug

Trace logs location, where to view them

◇◆丶佛笑我妖孽 提交于 2019-12-28 05:52:25
问题 Where do you see Trace.Write(""); logs while developing an MVC or WCF app? What is the correct place to look at? 回答1: When using the System.Diagnostics.Trace class, the Write method writes its trace output "to the trace listeners in the Listeners collection." The Trace.Listeners property by default only contains an instance of the DefaultTraceListener, which outputs messages to the debugger output window. To view those trace messages, you have to enable debugging, of course. So if you debug

Why is my machine writing stderr into stdout?

独自空忆成欢 提交于 2019-12-25 04:30:16
问题 While writing code against the System.Diagnostics.Process tools in C#, I was catching only StandardOutput and parsing it. However, a unit test around this failed on the build server. After a colleague tried on his machine, it failed as well. Then I found Jon Skeet's answer to a question about why StandardOutput was empty, and he mentioned capturing both StandardOutput and StandardError from System.Diagnostics.Process. Sure enough, we tried that on my colleague's machine and it worked. My

Is there a way to get a list of processes running on a local virtual machine?

耗尽温柔 提交于 2019-12-24 02:30:29
问题 I've got a virtual machine running on Windows 7 called "VirtualXP-12345". I tried using System.Diagnostics.Process.GetProcesses("VirtualXP-12345") from the host machine but that doesn't work. I just get InvalidOperationException("Couldn't connect to remote machine."). I am trying to write a program that checks that a particular process is running on a PC, including all virtual machines also running on that machine. It works fine using Pocess.GetProcesses() on the local non-virtual machine,

Why would I turn System.Diagnostics trace autoflush off?

。_饼干妹妹 提交于 2019-12-23 19:31:08
问题 In all my applications, I have always set <trace autoflush="true" /> Is there any reason why someone would want not to do that? I guess there is a performance impact, but how big is it? 回答1: From the docs: Trace.AutoFlush Property Gets or sets whether Flush should be called on the Listeners after every write. For performance reasons, you might prefer flushing less frequently (less IO). The downside of this is, lines that are not flushed will be lost in case of a crash. Edit: The impact will