-
Notifications
You must be signed in to change notification settings - Fork 54
Configure wcf service library
Scott Xu edited this page Apr 8, 2014
·
2 revisions
First you have to create a new class NinjectFileLessServiceHostFactory that creates and initializes the kernel:
public class NinjectFileLessServiceHostFactory : NinjectServiceHostFactory
{
public NinjectFileLessServiceHostFactory()
{
var kernel = new StandardKernel(new ServiceModule());
kernel.Bind<ServiceHost>().To<NinjectServiceHost>();
SetKernel(kernel);
}
}
Then extend the App.Config by adding the following configuration to the system.serviceModel configuration:
<serviceHostingEnvironment>
<serviceActivations>
<add factory="WcfServiceLibrary.NinjectFileLessServiceHostFactory" service="WcfServiceLibrary.ServiceLayer.TimeService" relativeAddress="WcfServiceLibrary.ServiceLayer.TimeService.svc"/>
</serviceActivations>
</serviceHostingEnvironment>