Share via


How To: Consume the Service Management Service

This topic describes the steps to consume the Service Management Service. See Service Management Service for conceptual details about the service.

  1. Open the root Web.config file in any editor. You can find this file in the %WINDIR%\Microsoft.NET\<Framework or Framework64>\v4.0.xxxxx\Config folder.

  2. Search for the keyword: ServiceManagementBehavior in the configuration file.

  3. Modify the service behavior definition to enable publishing service metadata over HTTP as shown in the following example.

    <behavior name="ServiceManagementBehavior">
        <serviceMetadata httpGetEnabled="true" />
    </behavior>
    
  4. Save the Web.config file. You will receive an error message if you do not have write permission to the configuration file. Update the access control list (ACL) on the file and then try to save it again.

  5. Right-click your client project, and then click Add Service Reference.

  6. Type https://localhost/<application name>/ServiceManagement.svc for the address and click Go.

  7. Click OK to close the Add Service Reference dialog box.

  8. Add code similar to the following code to invoke the Service Management Service to activate a service in your application.

                ServiceManagementClient clnt = new ServiceManagementClient();
                ActivationRequest request = new ActivationRequest();
                request.VirtualPath = "https://localhost/MyWFServiceApp/MyWFService.xamlx";
                clnt.ActivateService(request);