<add> of <serviceActivations>

A configuration element that allows you to define virtual service activation settings that map to your Windows Communication Foundation (WCF) service types. This makes it possible to activate services hosted in WAS/IIS without an .svc file.

<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment>
      <serviceActivations>
        <add>

Syntax

<serviceHostingEnvironment>
    <serviceActivations>
      <add factory="String"
           service="String" />
  </serviceActivations>
</serviceHostingEnvironment>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
factory A string that specifies the CLR type name of the factory that generates a service activation element.
service The ServiceType that implements the service (either the full qualified Typename or the short Typename (when it is placed in the App_Code folder).
relativeAddress The relative address within the current IIS application - for example "Service.svc". In WCF 4.0 this relative address has to contain one of the known file extensions (.svc, .xamlx, ...). No physical file has to exist for the relativeUrl

Child Elements

None.

Parent Elements

Element Description
<serviceHostingEnvironment> A configuration section that describes activation settings.

Remarks

The following example shows how to configure activation settings within your web.config file.

<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment>
      <serviceActivations>
        <add service="GreetingService" />
      </serviceActivations>
    </serviceHostingEnvironment>
  </system.serviceModel>
</configuration>

Using this configuration, you can activate the GreetingService without using an .svc file.

Note that <serviceHostingEnvironment> is an application level configuration. You have to place the web.config containing the configuration under the root of the virtual Application. In addition, serviceHostingEnvironment is a machineToApplication inheritable section. If you register a single service in the root of the machine, every service in the application will inherit this service.

Configuration-based activation supports activation over both http and non-http protocol. It requires extensions in the relativeAddress, i.e. .svc, .xoml or .xamlx. You can map your own extensions to the know buildProviders, which will then enable you to activate service over any extension. Upon conflict, the <serviceActivations> section overrides .svc registrations.

See also