-
Notifications
You must be signed in to change notification settings - Fork 53
Setup selfhosted WCF services
Scott Xu edited this page Apr 7, 2014
·
6 revisions
Selfhosting of WCF services is based on Ninject.Web.Common.SelfHosting. To use it you have to follow the documentation of this package.
Once this is done you can define WCF service configurations using the static methods on NinjectWcfConfiguration. The simplest variant is to specify what factory shall by used for a service type
NinjectWcfConfiguration.Create<TimeService, NinjectServiceSelfHostFactory>();
NinjectWcfConfiguration.Create<TimeWebService, NinjectWebServiceSelfHostFactory>();There are two factories you can choose from:
- NinjectServiceSelfHostFactory is for normal web services
- NinjectWebServiceSelfHostFactory can be used for REST web services
There are other overloads that allow to configure the service host by specifying an action that is executed when the service host is created.
NinjectWcfConfiguration.Create<TimeService, NinjectServiceSelfHostFactory>(
servicehost => servicehost.AddServiceEndpoint( ... ));The WCF services can be configured using the usual way in the section of the App.config