如何调试WCF程序程序、WCF

2023-09-03 03:22:45 作者:深爱的另一个名字叫卑微

我的code使用大量WCF的电话,当我尝试调试它,它不进入C本身的服务,$ C $。有没有办法以某种方式来调试WCF code?

My code uses lots of WCF calls and when I try to debug it, it doesnt go to the service code itself. Is there a way to debug WCF code somehow?

推荐答案

您需要将调试器附加到您的WCF服务在运行的进程。

You need to attach the debugger to the process that your wcf service is running in.

如果在IIS中您需要连接到相应的w3p.exe过程。

If in iis you need to attach to the corresponding w3p.exe process.

如果在一个独立的应用程序或窗口服务,连接到你的exe文件的名称。

If in a stand alone app or windows service, attach to the name of your exe.

在Visual Studio中,调试菜单上,有一个附加到进程。打开相关的code,设置一个断点,并调用该服务使处理器执行的code路径。

In Visual Studio, on the debugger menu, there is an "attach to process". Open the relevant code, set a breakpoint, and call the service causing that code path to execute.

调试之外,使用.NET跟踪与切换水平是一个很好的方式来获得洞察力,这是怎么回事。我通常设置SYS内部DebugView的颜色突出显示错误和警告,并不断有它运行在运行code或测试。彩色线条勾勒出我的余光工作时发现的问题。

Outside of debugging, using .net tracing with switchable levels is a good way to get insight to what's going on. I typically setup sys internals debugview to color highlight errors and warnings and constantly have it running while running code or tests. Colored lines out of my peripheral vision while working finds issues.