Partilhar via


<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.

Schema Hierarchy

<system.serviceModel>
  <serviceHostingEnvironment>

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

A string that specifies the name of the service application.

relativeAddress

A string that specifies the relative address of the service.

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 relatativeAddress, 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

Reference

ServiceActivationElement
ServiceHostingEnvironmentSection
ServiceHostingEnvironment