Service Management Service

Windows Server AppFabric provides an environment for running and managing WCF and WF services. The Service Management Service further enhances AppFabric management capabilities by providing clients the ability to start services remotely. The Service Management Service is a WCF service that AppFabric automatically adds to all applications with the serviceManagement attribute enabled.

Scenarios Supported by the Service Management Service

The Service Management Service supports the following primary scenarios.

Activation of workflow service instances

The Workflow Management Service (WMS) invokes the Service Management Service (SMS) to activate workflow service instances that have pending work. The SMS activates a workflow service host, which creates an instance store (such as SQL Workflow Instance Store) and invokes a method on the store to load the workflow service instance from the instance store into memory. For more details about instance activation, see Workflow Management Service.

Important

The Workflow Management Service requires the net.pipe protocol to be enabled for the application containing the service and the net.pipe binding enabled for the site containing the service.

Scheduled startup of services

In this scenario, a custom scheduler starts services in an application according to the schedule created by a user. For example, a service may need to process a batch of work items on a daily basis. Note that the Service Management Service feature enables this scenario but does not provide a custom scheduler.

Configurations

The AppFabric installation adds the following service activation parameters to root Web.config that are used when activating the Service Management Service for each application with the serviceManagement attribute enabled.

<system.serviceModel>
    <serviceHostingEnvironment>
        <serviceActivations>
            <add relativeAddress="~/ServiceManagement.svc" service="Microsoft.ApplicationServer.Hosting.Management.ServiceManagement" factory="Microsoft.ApplicationServer.Hosting.Management.ServiceManagementFactory, Microsoft.ApplicationServer.Hosting, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </serviceActivations>
    </serviceHostingEnvironment>
</system.serviceModel>

The Service Management Service supports only the net.pipe protocol for bindings. The address of a Service Management Service added to an application conforms to the following address pattern: {scheme}://hostname:port/<application>/ServiceManagement.svc. For example: net.pipe://localhost/VirtualApplicationB/ServiceManagement.svc.

Warning

The Windows Server AppFabric installation assumes that the .svc extension is mapped to a WCF HTTP handler in the root Web.config. If you have the .svc extension mapped to a handler other than a WCF HTTP handler, the Service Management Service (SMS) will fail to initialize. If you have some other extension mapped to the WCF HTTP handler, update the extension of SMS from .svc to that extension in the root Web.config. Note that this workaround will not work if you have .svc handler mapping is overridden at the application level.

The Service Management Service feature is enabled by default. The AppFabric installation enables the feature by adding a serviceManagement element to root Web.config and by setting the enabled attribute on the element to true. These settings are inherited by application, virtual directory, and service levels. Therefore, the serviceManagement attribute is enabled for all applications on a computer on which AppFabric is installed.

<microsoft.applicationServer>
    <hosting>
        <serviceManagement enabled=”true” endpointConfiguration=”” authorizedWindowsGroup=”AS_Administrators” />
    </hosting >   
</microsoft.applicationServer>

The following table provides descriptions of attributes of the serviceManagement element.

Attribute Description

enabled

The AppFabric installation program sets this attribute to true by default in root Web.config.

authorizedWindowsGroup

The Windows group that has access to the endpoint exposed by the Service Management Service. The AppFabric installation program sets AS_Administrators as the authorized Windows group. The identity under which the application runs also has access to the endpoint.

endpointConfiguration

References a standard service management endpoint defined in the standardEndpoints section in root Web.config. The default value of this attribute is ServiceManagementNetPipeEndpoint.

// fragment from root Web.config 
<serviceManagement endpointConfiguration="ServiceManagementNetPipeEndpoint" enabled="true" authorizedWindowsGroup="AS_Administrators" />

You can disable service management for an application by adding the following configuration to the application Web.config.

<serviceManagement enabled=”false” />

You can remove the Service Management Service altogether by adding the following configuration to the application Web.config.

<serviceActivations>
     <remove relativeVirtualPath=”~/ServiceManagement.svc” />
</serviceActivations>

Note

The Service Management Service uses the ServiceHostingEnvironment.EnsureServiceAvailable method internally. This method does not support using ASP .NET routing paths to activate services. Therefore, the Service Management Service does not support this activation scenario.

See Also

Concepts

How To: Consume the Service Management Service