I want to host a WCF service of mine on Microsoft IIS (IIS hosting).
To do this, I created my service:
// The service
public class MyService : IMySer
You must write several custom classes to support creating service with parameters:
IInstanceProvider
. This class will be responsible for creating your service instance with your non default constructor.IServiceBehavior
. This class will be responsible for adding custom instance provider into endpoint dispatcher.ServiceHost
which will apply your behavior.ServiceHostFactory
which will instantiate your custom service host. You will reference this factory from .svc file.This is generally the same as building support for dependency injection. You can check for example this article.