How to consume an ASP.NET Web Service in Windows Console App (VS2008)
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:
Comparison context menus in VS2008 for Web Service. http://blog.clarkmichael.com/content/binary/VS2008_ProjContextMenu.jpg
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.
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.
精彩评论