How to: Create a Host Process

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials

To create the host process that your provider uses, you use the ProviderHost object of the Provider Framework. ProviderHost is similar in its functionality to System.ServiceModel.ServiceHost and actually uses it internally. ProviderHost creates a host environment for your provider so that it can be instantiated and used by client applications or other providers.

In addition to hosting your provider, ProviderHost registers the information about the provider in the Provider Registry. This is the information that your client application queries to discover the provider. ProviderHost also decides which network protocols to use. Currently, providers are opened for operation on named pipes and TCP.

Before you start the procedures in this section, you should complete the procedures listed in How to: Create a Provider.

To create the host process

  1. In the ChatSample project, add a reference to the WssgCommon.dll file.

  2. Open the Program.cs file and ensure that the Main method contains the following code:

    static void Main(string[] args)   
    {  
      WindowsServerSolutionsEnvironment.Initialize();  
      ProviderHost host = new ProviderHost(typeof(ProviderService), "provider");  
      host.Open();  
      System.Console.ReadLine();  
      host.Dispose();  
    }  
    
  3. Save the project.

The next step is to create the client. To do this, see How to: Create a Client.