在C#中调用该方法
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] public statSEO靠我ic extern void OutputDebugString(string message);System.Diagnostics.Trace.WriteLine也可以实现和OutputDebugSEO靠我String类似的效果
测试代码如下
using System; using System.Collections.Generic; using System.SEO靠我Linq; using System.Text; using System.Runtime.InteropServices; namespace DeSEO靠我bugViewTest { class Program { [DllImport("kernel32.dll", CharSet = CSEO靠我harSet.Auto)] public static extern void OutputDebugString(string message); static vSEO靠我oid Main(string[] args) { Console.WriteLine("BEGIN"); for (int i = 0; i < 10SEO靠我; i++) { OutputDebugString("debugstring"); System.Diagnostics.Trace.WriteLinSEO靠我e("tracestring"); } Console.WriteLine("END"); } } }运行测试程序,查SEO靠我看DebugView的日志列表
DebugView会默认连接到 本机local
在C#中调用时不管编译的是Debug还是Release都是能正常捕获的远程调试需要在本地和远程机器上都启动DebSEO靠我ugView进程
远程机器作为接收请求的一端,需要在命令行下加参数启动 ,即 dbgview /a 可以使用 tasklist /fi “imagename eq dbgview.exe”命令得到dbgviSEO靠我ew的进程id
再结合 netstat -ano | find命令找到dbgview监听的端口
如图所示,dbgview默认监听2020端口本机作为请求的一端,可以通过菜单栏的 “Connect” 按钮连接SEO靠我到远程的DebugView
需要先断开到本地的默认连接
1.服务进程监控
DebugView默认捕获应用层普通的win32应用程序,菜单栏默认 勾选 “Capture Win32”
如果被监SEO靠我控进程是以windows服务形式存在的,那么需要使用管理员权限启动DebugView进程
然后在DebugView菜单栏勾选 “Capture Global Win32”
勾选 "Capture KernSEO靠我el"会对内核的日志输出进行捕获
2.一些服务器防火墙开启的情况下,需要对dbgview监听的端口进行放行网站备案号:浙ICP备17034767号-2