Adding a Web Service Reference to a Windows Service

by Kev Ritchie 9. November 2010 14:19

Spent a few minutes trying to figure out how to add a Web Service reference; instead of a Service reference, to a Windows Service project.

Turns out it's pretty simple.

1. Right click on your Windows Service project and select 'Add Service Reference'.  The 'Add Service Reference' dialog should appear.

2. Click 'Advanced...' (highlighted above), the 'Service Reference Settings' dialog should now appear:

3. Click 'Add Web Reference...'.

4. You should then get the 'Add Web Reference' dialog (which if you're familiar with ASP.NET and Web Services, you will recognise).

In the 'Add Web Reference' dialog, you can type in the URL of a known Web Service and click Go (the arrow to the right of the URL Address box) or you can select on of three options 'Web services in this solution', 'Web services on the local machine' or 'Browse UDDI Servers on the local network'.

The following article in MSDN library has a little more information on this screen:

Which ever action you choose, if a Web Service is found it will populate the 'Web services found at this URL:' list on the right hand side of the dialog box.  There could be multiple results here, so select the appropriate service, change the 'Web reference name' if appropriate and click Add Reference.

You should now have a reference to a Web Service in your Windows Service project.

Comments are closed

Powered by BlogEngine.NET
Theme by Mads Kristensen | Modified by Mooglegiant