Поделиться через


Activation Without .svc files – Config Based Activation (CBA)

.Svc files were perceived as a management overhead. In Net Framework 4.0, WCF  services hosted in WAS/IIS do not require .svc file anymore.

We can activates service through the  config Based Activation feature.

This feature allows for registration of services in web.config file. Here is a sample registration for two services in a single web.config file.

 <system.serviceModel>
 <serviceHostingEnvironment>
   <serviceActivations>   <add relativeAddress=”CreditCheckService.svc” service=”Microsoft.ServiceModel.Samples.CreditCheckService” />   <add relativeAddress=”Payment/Service.svc” service=”Microsoft.ServiceModel.Samples.PaymentCheckService” />
  </serviceActivations>
 </serviceHostingEnvironment>
</system.serviceModel>
  

 

 

Some details to remember about  config Based Activation feature

  1. serviceHostingEnvironment is an application level configuration. Please place the web.config containng the configuration under the root of the virtual Application.
  2. CBA supports activation over both http and non-http protocol
  3. CBA feature 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.
  4. Upon confict, CBA overrides .svc registrations.
  5. serviceHostingEnvironment is a machinetoApplication inheritable section. If you register a single service in the root of the machine then every service in the application will inherit this service.