How to add a web service reference in Visual Studi

2019-02-22 08:25发布

问题:

Is there a way to easily add a web service reference to a Visual Studio 2015 console application?

回答1:

Right click References -> Add Service Reference.

(i.e. don't right-click the Project name.)



回答2:

If you don't have References -> Add Service Reference, you probably use VS2015 and new Console Applicaiton template, to add WCF service you need to:

  • Right click on References -> Add Connected Service
  • Click 'Find more services...' at the bottom of window.
  • Search for 'Visual Studio WCF Connected Service' and install
  • After VS restart, by clicking on 'Add Connected Service' you will be able to do what you wanted.

edit: Link to documentation of 'Visual Studio WCF Connected Service': https://blogs.msdn.microsoft.com/webdev/2015/12/15/wcf-connected-service-visual-studio-extension-preview-for-asp-net-5-projects/