Accessing a WCF Service in Visual Basic Express

Visual Studio 2008

Windows Communication Foundation (WCF) services enable you to expose an application's functionality as a service that other applications can access. Although you cannot create a WCF service by using Visual Basic 2008 Express Edition, applications that you create with Visual Basic Express can access existing WCF services. This enables you to create more robust applications that can access functionality that already exists in a WCF service. In the following example, you will learn how to set a reference to an existing WCF service.

NoteNote:

This is the same process you would follow for adding a reference to any Web service. Add Service Reference replaces Add Web Reference in earlier versions of Visual Basic Express.

To reference a WCF service

  1. On the File menu, point to Add and then click New Project.

  2. In the New Project dialog box, click Windows Forms Application, and then click OK.

  3. In Solution Explorer, right-click the project and click Add Service Reference. The Add Service Reference dialog box will appear.

  4. In the Add Service Reference dialog box, add the URL of the WCF service.

  5. Click OK to add the service reference.

After you have referenced the WCF service, you can access its methods from your application.

In this lesson, you learned how to set a reference to a WCF service so that you can access it from your application. In the next set of lessons, you will learn about reading from and writing to text files.

Next Lesson: Using the File System: Writing to and Reading from Files

Community Additions

ADD
Show: