Step 4 - Setting Up the WCF Service

In this step you create an Orders WCF Service that returns all orders for a specified customer.

  1. To edit the default WCF Service that was automatically added to your project when you created it, go to the Solution Explorer, and rename Service1 to the name you want to give your service. For example, OrderService.

  2. Next, select the .svc file in the Solution Explorer to display it's code in the Code Editor.

  3. Right-click the class name and select Rename from the shortcut menu. Type the new name of the service (for example, OrderService), then click Apply.

  4. Now, you can rename the associated service interface. To do this, go to the Solution Explorer and rename IService1.cs/.vb to the name of your service with an "I" prefix. For example, IOrderService.

  5. A dialog appears asking if you want to rename all references to the code element. Click Yes, and all references are automatically updated.

  6. The default WCF service and interface you just renamed have two sample methods:

    1. GetData
    2. GetDataUsingDataContract

    Remove these sample methods from the WCF Service and the interface, and replace them with your own custom methods.

  7. Finally, right-click the .svc file in the Solution Explorer and select Set As Start Page from the shortcut menu.

    See Also:
    Step 5 - Running the WCF Service


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 08/01/17
Comment or report problem with topic