system.diagnostics

C# app to act like WINDBG's “step into” feature

£可爱£侵袭症+ 提交于 2019-12-11 02:06:46
问题 I do a lot "academic" security projects mostly targeted at Linux platforms but recently I've had some interest in Windows. So what I'm I've done is make some small tools like an app to crash other apps and such, just to provoke behavior. So I've had to use WINDBG a lot for stepping through processes, which is been pretty useful, way cooler than GDB(linux). So the tool I'm trying to make now is essentially just like the stepping feature in WINDBG. What I can do is launch a process as a System

Detect if hard disk is being accessed or not

冷暖自知 提交于 2019-12-10 23:30:19
问题 I am trying to make a very simple hard disk access monitor to work like those embedded LEDs that blink according to drive usage . That LED REALLY helps me, but the laptop I am using does not have it. =[ So, I've made a simple tray icon application, but I don't know how to determine that variable of disk access. I've searched for it and found something like System.Diagnostics.PerformanceCounter , but I have no idea on using it for my task. If there is another solution, I'd also appreciate! =]

Running a program with System.Diagnostics.Process.Start causes an Application Error

十年热恋 提交于 2019-12-10 19:44:43
问题 On my PC DWG files open with: "C:\Program Files\AutoCAD LT 2007\acadlt.exe" "%1" If I run this from the command line: "C:\Program Files\AutoCAD LT 2007\acadlt.exe" "C:\Some Path\Test.dwg" AutoCAD Lite open the DWG file. Similarly if I open a command prompt and run the same exe with argument, it works fine. However if I use var proc = new System.Diagnostics.Process(); var info = new System.Diagnostics.ProcessStartInfo(); and then info.FileName = "C:\Some Path\Test.dwg"; proc.StartInfo = info;

Identify the w3wp System.Diagnostics.Process for a given application pool

左心房为你撑大大i 提交于 2019-12-10 15:26:19
问题 I got few web sites running on my server. I have a "diagnostic" page in an application that shows the amount of memory for the current process (very useful). Now this app is 'linked' to another app, and I want my diagnostic page to be able to display the amot of memory for another w3wp process. To get the amount of memory, I use a simple code : var process = Process.GetProcessesByName("w3wp"); string memory = this.ToMemoryString(process.WorkingSet64); How can I identify my second w3wp process

How to start a IIS process with specific username & password

一曲冷凌霜 提交于 2019-12-10 13:49:13
问题 I'm trying to run an application from our internal website. When I use Process.Start("notepad"); I can see that notepad process started in our web server with default identity mentioned in the app pool setting. But I have to start the process with specific user name & password. So I have tried to run this line of code string password = "XXXXX"; System.Security.SecureString securePwd = new System.Security.SecureString(); foreach (char c in password) { // Append the character to the password.

Does System.Diagnostics.Trace have any performance degredation?

眉间皱痕 提交于 2019-12-10 04:00:00
问题 I am looking for a simple native .NET error logging solution. I am not interested in using log4net, Elmah or any other logging library. Below is what I am planning on using. My question is performance on my site is paramount and does this flow introduce any performance concerns? Global.asax protected void Application_Start(object sender, EventArgs e) { GlobalFilters.Filters.Add(new HandleExceptionsAttribute()); } Handle Exceptions Attribute: public sealed class HandleExceptionsAttribute :

What should I identify with the id argument in TraceSource.TraceEvent method?

与世无争的帅哥 提交于 2019-12-09 09:18:51
问题 I use the TraceSource class for logging in my .NET projects. However a point that has never been clear to me is, what the intent of the id parameter in the TraceEvent method. Currently, I always set it to 0. But what is the expected or typical useful usage of it? I can think of a few possibilities: It is an ID for the occurrence of the event (i.e. the same line of code produces a different ID on each execution); It is an ID for the method call (i.e. you can infer the line of code from the ID)

Automatically log System.diagnostics.trace messages to an Nlog target

半城伤御伤魂 提交于 2019-12-09 02:53:19
问题 Say you have C# trace messages all over an application. Something like: Trace.TraceInformation("Service Started"); How do you automatically log this to an nLog target without having to add code like the following to all the classes that have trace messages? using NLog; private static Logger logger = LogManager.GetCurrentClassLogger(); Is there a way to do this without including traces produced by the .NET Framework itself, which this article demonstrates how to do? 回答1: This works for cases

How to dynamically set log file using App.config and System.Diagnostics?

点点圈 提交于 2019-12-07 08:28:38
问题 I was looking for a solution to provide logging to my latest project when I came across an article ( http://www.daveoncsharp.com/2009/09/create-a-logger-using-the-trace-listener-in-csharp/ ) that talked about using System.Diagnostics and App.config to log via the Trace method. I was able to successfully implement both the class and the App.config but I'd really like to be able to dynamically assign the value/location (inside initializeData) of the log file and I don't have a clue how to do it

TextWriterTraceListener does not work

浪子不回头ぞ 提交于 2019-12-07 07:47:46
问题 Config file: <system.diagnostics> <trace> <listeners> <add name="Console" type="System.Diagnostics.ConsoleTraceListener" initializeData="false"></add> <add name="Text" type="System.Diagnostics.TextWriterTraceListener" initializeData="D:\uat\logs\bifit.log" traceOutputOptions="DateTime"></add> </listeners> </trace> </system.diagnostics> The code: static void Main(string[] args) { try { Trace.WriteLine("Running BiFit Test Server."); } } I can see the text in cosole window. And the file is