wcf 断点 调试_WCF 调试的限制

WCF 调试的限制Limitations on WCF Debugging

11/04/2016

本文内容

有三种开始 WCF 服务调试的方式:There are three ways that you can begin debugging a WCF service:

调试调用服务的客户端进程。You are debugging a client process that calls a service. 调试器单步执行该服务。The debugger steps into the service. 该服务不必与客户端应用程序处于同一个解决方案中。The service does not have to be in the same solution as your client application.

调试请求服务的客户端进程。You are debugging a client process that makes a request to a service. 该服务必须是解决方案的一部分。The service must be part of your solution.

使用“附加到进程”可附加到当前正在运行的服务。You use Attach to Process to attach to a service that is currently running. 调试将在该服务内部开始。Debugging begins inside the service.

本主题描述了有关这些方案的限制。This topic describes limitations on these scenarios.

单步执行服务的限制Limitations on Stepping Into a Service

若要从正在调试的客户端应用程序单步执行服务,必须满足下列条件:To step into a service from a client applications that you are debugging, the following conditions must be met:

客户端必须使用同步客户端对象调用服务。The client must call the service by using a synchronous client object.

协定操作不能是单向的。The contract operation cannot be one-way.

如果服务器是异步的,则无法在服务内部执行代码时查看完整的调用堆栈。If the server is asynchronous, you cannot view the full call stack while you are executing code inside the service.

必须使用 app.config 或 Web.config 文件中的以下代码启用调试:Debugging must be enabled with the following code in the app.config or Web.config file:

此代码只需添加一次。This code only has to be added one time. 可以通过编辑 .config 文件或使用“附加到进程”将代码附加到服务中来添加此代码。You can add this code by editing the .config file or by attaching to the service by using Attach to Process. 在对服务使用“附加到进程”时,调试代码将自动添加到 .config 文件中。When you use Attach to Process on a service, the debug code is automatically added to the .config file. 随后,您可以调试并单步执行该服务,而无需编辑 .config 文件。After that, you can debug and step into the service without having to edit the .config file.

跳出服务的限制Limitations on Stepping Out of a Service

跳出服务并返回到客户端与单步执行服务具有相同的限制(如上所述)。Stepping out of a service and back to the client has the same limitations described for stepping into a service. 另外,调试器必须附加到客户端上。In addition, the debugger must be attached to the client. 若要调试客户端并单步执行服务,调试器将继续附加到服务中。If you are debugging a client and step into a service, the debugger remains attached to the service. 无论使用“启动调试”启动客户端,还是使用“附加到进程”将调试器附加到客户端,都是如此 。This is true whether you started the client by using Start Debugging or attached to the client by using Attach to Process. 如果是通过附加到服务开始调试的,则说明尚未将调试器附加到客户端。If you began debugging by attaching to the service, the debugger is not yet attached to the client. 在这种情况下,如果需要跳出服务并返回到客户端,必须先使用“附加到进程”手动附加到客户端。In that case, if you have to step out of the service and back to the client, you must first use Attach to Process to attach to the client manually.

自动附加到服务的限制Limitations on Automatic Attach to a Service

自动附加到服务具有下列限制:Automatically attaching to a service has the following limitations:

该服务必须是要调试的 Visual StudioVisual Studio 解决方案的一部分。The service must be part of the Visual StudioVisual Studio solution you are debugging.

该服务必须进行托管。The service must be hosted. 它可以是网站项目(文件系统和 HTTP)、Web 应用程序项目(文件系统和 HTTP)或 WCF 服务库项目的一部分。It may be part of a Web Site project (File System and HTTP), Web Application project (File System and HTTP), or WCF Service Library project. WCF 服务库项目可以是服务库或工作流服务库。WCF Service Library projects can be either Service Libraries or Workflow Service Libraries.

必须从 WCF 客户端调用该服务。The service must be invoked from a WCF client.

必须使用 app.config 或 Web.config 文件中的以下代码启用调试:Debugging must be enabled with the following code in the app.config or Web.config file:

自我托管Self-Hosting

“自承载服务”是指不在 IIS、WCF 服务主机或 ASP.NETASP.NET 开发服务器内部运行的 WCF 服务。A self-hosted service is a WCF service that does not run inside IIS, the WCF Service Host, or the ASP.NETASP.NET Development Server. 有关如何调试自我托管服务的信息,请参阅如何:调试自承载 WCF 服务。For information about how to debug a self-hosted service, see How to: Debug a Self-Hosted WCF Service.

若要启用 ASP.NETASP.NET 3.0 或 3.5 应用程序的调试,则必须在安装 Visual Studio 2010Visual Studio 2010 之前安装 ASP.NETASP.NET 3.0 或 3.5。To enable debugging of ASP.NETASP.NET 3.0 or 3.5 applications, ASP.NETASP.NET 3.0 or 3.5 must be installed before Visual Studio 2010Visual Studio 2010 is installed. 如果在安装 ASP.NETASP.NET 3.0 或 3.5 之前安装了 Visual Studio 2010Visual Studio 2010,则在尝试调试 ASP.NETASP.NET 3.0 或 3.5 应用程序时会出错。If Visual Studio 2010Visual Studio 2010 is installed before ASP.NETASP.NET 3.0 or 3.5, an error occurs when you try to debug a ASP.NETASP.NET 3.0 or 3.5 application. 错误消息为:无法自动单步执行服务器。The error message is, "Unable to Automatically Step Into the Server." 若要修复此问题,请使用 Windows“控制面板” > “程序和功能”来修复 Visual Studio 2010Visual Studio 2010 安装。To fix this problem, use the Windows Control Panel > Programs and Features to repair your Visual Studio 2010Visual Studio 2010 installation.

请参阅See also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值