有没有办法在 VS 2010 中禁用 WCF 服务调试?

发布于 2024-10-05 01:13:01 字数 756 浏览 1 评论 0原文

我有一个 ASP.NET Webforms 应用程序,它通过 WCF 服务代理使用第三方服务,该代理是我在 Visual Studio 2010 中使用“添加服务引用”命令创建的。

我在单独的部分类定义中向生成的 Client 类添加了几个公共方法,以便即使我重新生成代理,它们也仍然存在。我的其余代码调用这些方法,而不是直接调用映射到 api 调用的代理方法。

我遇到的问题是当我需要调试我添加的方法时。当我在创建的方法之一中放置断点,然后尝试单步执行或单步执行代码时,Visual Studio 会挂起一段时间,然后返回并显示以下错误:

无法自动单步进入服务器。连接到服务器计算机“[服务地址]”失败。调试器无法连接到远程计算机。这可能是因为远程计算机不存在,或者防火墙可能阻止与远程计算机的通信。请参阅“帮助”以获取帮助。

发生此错误后,Visual Studio 会自动退出我正在调试的方法,从而阻止我调试客户端代码。

Visual Studio 正在尝试连接到远程第 3 方服务以尝试对其进行调试。但是,我无法控制该服务,也永远无法让它执行此操作。

有什么方法可以告诉 Visual Studio 不要尝试调试此远程服务而只调试客户端代码吗?

更新

我正在查看生成的客户端的代码,我发现它应用了 DebuggerStepThroughAttribute,所以我想这解释了我遇到的问题,它不允许我进入我的代码,但它仍然没有解决阻止 VS 尝试调试远程服务的更大问题。

I have an ASP.NET webforms app that is consuming a third party service via a WCF service proxy that I created in Visual Studio 2010 with the Add Service Reference command.

I have added several public methods to the generated Client class in a separate partial class definition so that they persist even if I regenerate the proxy. These methods are what the rest of my code calls instead of directly calling the proxy methods that map to the api calls.

The problem I run into is when I need to debug the methods I have added. When I place a breakpoint in one of the methods I created and then attempt to Step Over or Step Into the code, Visual Studio hangs for some time and then returns with the following error:

Unable to automatically step into the server. Connecting to the server machine '[address of service]' failed. The debugger cannot connect to the remote computer. This may be because the remote computer does not exist or a firewall may be preventing communication to the remote computer. Please see Help for assistance.

After this error occurs Visual Studio automatically Steps Out of the method I was debugging, preventing me from debugging my client-side code.

Visual Studio is attempting to connect to the remote 3rd party service to try and debug it. However, I have no control over this service and will never have access to let it do this.

Is there any way to tell Visual Studio to not attempt to debug this remote service and just debug the client-side code?

UPDATE

I was looking at the code of the generated Client, and I saw that it has the DebuggerStepThroughAttribute applied to it, so I guess that explains the problem I was having with it not letting me Step Into my code, but it still doesn't solve the larger issue of preventing VS from trying to debug the remote service.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方觉久 2024-10-12 01:13:01

我认为 Visual Studio 现在已经为 WCF 库项目内置了 WCF 服务主机行为。据我所知,关闭它的唯一方法是将项目类型更改回普通库。您可以通过手动编辑 .csproj 来完成此操作:从 中删除 {349c5851-65df-11da-9384-00065b846f21}(以及关联的分号)。

I think Visual Studio has the WCF service host behavior built in for WCF Library projects now. As far as I can tell the only way to turn it off is to change the project type back to a normal Library. You can do that by editing the .csproj manually: remove {349c5851-65df-11da-9384-00065b846f21} (and the associated semicolon) from <ProjectTypeGuids>.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文