Export (0) Print
Expand All

How to: Extend Web Services

Updated: October 17, 2013

Applies To: Windows Server 2012 Essentials

To add a web service, follow these steps:

  1. In Visual Studio, open the Web Service API for Windows Server Essentials template.

  2. Create the web.config file. This file should contain code that is similar to the following:

          <service name="mynamespace.TestService">
            <endpoint kind="webHttpEndpoint"
                      contract="mynamespace.ITestService" />

    If you do not want to set the endpoint configuration to the default endpoint, you can create your own endpoint configuration by following the Windows Communication Foundation (WCF) standard.

  3. Add the code to implement your web service. The web service class must declare the SBSWebServiceBehavior attribute (as shown in the example below), or else it will not operate correctly within the web service framework of Windows Server Essentials.

    namespace mynamespace
        // ...
        public class TestService : ITestService
            // Class implementation details
        // ...
  4. Set the location of the compiled binary code to %ProgramFiles%\Windows Server\bin.

  5. Compile the project.

  6. Copy the web service (*.svc) file and the web.config file to %ProgramFiles%\Windows Server\bin\webapi\YourOwnFolder.

  7. Restart IIS.

  8. Verify that the web service is running.

© 2014 Microsoft