如何在 Windows 控制台应用程序 (VS2008) 中使用 ASP.NET Web 服务
我过去曾在 Visual Studio(2005 及更早版本)中编写过 Windows 窗体或控制台应用程序,并且 IDE 有助于与 Web 服务的链接。现在我正在构建一个需要使用 Web 服务的应用程序,但是当我右键单击该项目(或引用)时,我没有看到“添加 Web 引用”上下文菜单项(对于 WinForm 或控制台应用程序)。如果我右键单击 Web 应用程序项目,就会有一个,但这对我没有帮助,因为我正在构建的应用程序必须是控制台应用程序。这不是 VS2005 中的行为。 描述 .NET 3.5 流程的 MSDN 页面并不区别;即不承认差异。
这不是我编造的,这也不是视错觉。下面是并排的两个上下文菜单:
比较 VS2008 中 Web 服务的上下文菜单。 http://blog.clarkmichael.com/content/binary/VS2008_ProjContextMenu.jpg
有人知道如何做我想做的事吗?我怀疑可以通过一些手动编码来完成,即使 IDE 不会提供帮助,但我不确定从哪里开始。
I have in the past coded up Windows Form or Console apps in Visual Studio (2005 and earlier), and the IDE has facilitated linking up with a web service. Now I am building an application that needs to consume a web service, but when I right-click on the project (or References), I do not see a "Add Web Reference" context menu item (for WinForm or Console app). There IS one if I right-click on a Web Application project, but this doesn't help me, as the application I am building MUST be a console app. This was not the behavior in VS2005. The MSDN page that describes the process for .NET 3.5 does not make a distinction; i.e. does not acknowledge a difference.
I am not making this up, and it is not an optical illusion. Here's are the two context menus, side by side:
Anybody have an idea how to do what I want? I suspect that it is possible to do via some hand-coding, even if the IDE isn't going to help out, but I'm unsure where to start.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
VS2008 MS 专注于 WCF 服务。您可以通过单击“添加服务引用...”并在接下来的对话框中单击“高级...”按钮来选择 Web 服务引用。在下面的对话框中,您可以选择添加 Web 服务引用。
With VS2008 MS is focused on WCF-Services. You can select a Webservice Reference by clicking "Add Service Reference..." and on the following dialog clicking the "Advanced..." button. In the following dialog you can choose to add a Web Service Reference.
使用“添加服务引用”选项。
Use the 'Add Service Reference' option.