Creating a Provider
Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials
A provider is a network service that exposes functionality from one component to another, which makes it easier for features to collaborate. For example, the Backup Provider is the software that allows the backup feature to expose its functionality to other components. Providers are individual Windows Communication Foundation (WCF) services that are developed on top of WCF and the Provider Framework API.
The following types of providers are used:
Core Providers – Providers that are delivered with the product, such as the Backup Provider or Alert Provider.
Feature Providers – Custom providers that can be created by using the Provider Framework API.
The following table lists some of the necessary parts of the Provider Framework architecture.
|Provider Registry||A service that provides a single point of discovery for all of the features that are involved in collaboration. It contains the information that is required to enable any feature to connect to any provider and consume the service that it provides.|
|Service Contracts||A service is a piece of software that provides a set of business functionality to the network and exposes that functionality at one or more endpoints. To create a service, you create a class that implements a Windows Communication Foundation (WCF) contract. For example, you define the contract as an interface and then you create a class that implements that interface.|
You can use the Provider Framework to solve the following problems:
Communication – The Provider Framework acts as a simple broker for independent providers. Providers can talk to each other in process, across processes, and across computers.
Discovery – Providers can discover other providers that implement a particular functionality.
To complete the procedures in this section, you must have some familiarity with C# development. You do not have to be familiar with Windows Communication Foundation (WCF) or the Provider Framework. If you want to learn more about WCF, see Windows Communication Foundation (https://go.microsoft.com/fwlink/p/?LinkId=164850).
Setting up the development environment
You can develop a provider on your development computer or you can develop a provider on a test server.
Because providers depend on the Provider Registry Service, if you develop your provider on a development computer, you must install the assembly on the server to test it.
Before you start to create your provider, you must download and install the Windows Server Essentials Add-in Templates into Visual Studio.
Confirm that you have installed the Windows Server Essentials SDK.
In Visual Studio, click Tools, and then click Extensions and Updates….
On the Extensions and Updates dialog, click Online, and then search for “Windows Server”.
In the results pane, click on Windows Server Essentials Add-In Templates, and then click Download.
On the Installation dialog, click Install, and then click Close.
The WSS Provider Service template should now be available through the New Project dialog, under the Templates directory.
You must also make sure that your development environment has access to the appropriate assemblies. You can accomplish this in two ways. One way is to install the Windows Server Essentials SDK on the computer where you will be developing the provider. Alternately, you can copy the needed assemblies from a server computer on the network and then follow these steps:
On the server, browse to the %WinDir%\Microsoft.NET\assembly\GAC_MSIL\ProviderFramework folder.
Copy the ProviderFramework.dll file to either a removable drive, or to a location that you can access from the development computer.
On the development computer, copy the ProviderFramework.dll file to a dependencies folder that can be referenced by your project.
Creating the provider files
See the following subsections for information about how to create a provider that demonstrates chat functionality:
Deploying the provider files on the server
After you have created the provider files, you must install the provider files by copying the assemblies to folders on the target server. To install the provider files, copy the object model and provider assemblies to %Program Files%\Windows Server\Bin on the server. If your provider uses a component that must run on the client, you must copy the assembly for the component to the %Program Files%\Windows Server\Bin folder on the client computer.
To deploy the chat example provider files
Copy the .exe file for the ChatWindow project from the bin\Debug folder to %Program Files%\Windows Server\Bin.
Copy the .dll files for the ChatSample.ObjectModel project from the bin\Debug folder to %Program Files%\Windows Server\Bin.
Copy the .exe for the ChatSample project from the bin\Debug folder to %Program Files%\Windows Server\Bin.
Run the ChatSample.exe file and then run one or more copies of the ChatWindow.exe file.
These instructions assume that the project was created by using default paths and that it was compiled in Debug mode.