Service Activation without Files

WCF services in IIS use a .svc file to bootstrap the process of activating a service. It’s possible but not recommended to put the entire service source code and definition in a .svc file to be dynamically compiled and run. Instead, the information that’s typically conveyed is:

- The identity of the service being instantiated

The base address at which the service exists within the address space of the overall web site  
  • The service host factory type that will be used to construct the service host

Based on the provided information, the service host factory is created, the service definition is loaded, and the service starts listening on the base address.

In .Net 4 it’s possible to define services through application or machine configuration as an alternative to creating a .svc file. The configuration includes the same information the .svc file would.

Service activation configuration is a new configuration element within the ServiceHostingEnvironment configuration section. The service activation configuration is a collection of service definitions that specify for each service:

- The identity of the service being instantiated

The relative address at which you would have put the service file before  
  • The service host factory type that will be used to construct the service host

The relative address functions exactly as if a file exists at the specified location. Based on the path of the relative address, requests will be passed to the service. Based on the extension of the relative address, a build provider will be invoked to construct the service. The only difference from before is that you don’t have to actually create or deploy the separate service files. Service files are virtualized from the information provided in the configuration.