Skip to content

Configure wcf services using svc file

jahav edited this page Mar 17, 2015 · 8 revisions

The only thing that has to be done in this scenario is to specify the factory that shall be used for the service in the svc file.

Therefore open the svc file and add a Factory attribute to the ServiceHost configuration. The value of this attribute specifies the factory that shall be used to create the service host of the service. There are three options:

  • Ninject.Extensions.Wcf.NinjectServiceHostFactory is used for ordinary services
  • Ninject.Extensions.Wcf.NinjectWebServiceHostFactory is used for REST services
  • Ninject.Extensions.Wcf.NinjectDataServiceHostFactory is used for data services

Example svc file:

<%@ ServiceHost 
Language="C#" Debug="true" 
Service="WcfTimeService.TimeService.TimeService" 
CodeBehind="TimeService.svc.cs" 
Factory="Ninject.Extensions.Wcf.NinjectServiceHostFactory" %>