How to set configuration on WCF when DI is used
I'm using this method to achieve DI in WCF. Now I'm at the point where I need to configure 开发者_JAVA百科the endpoints and bindings.
How and where should I do this?
The comment by flq is provides the answer: you can still use the normal WCF configuration settings even if you use an IInstanceProvider.
Since this is the idiomatic way of configuring WCF I see no reason to do it in any other way. It provides flexibility, there's tool support, and you'd be using the documented API.
For windsor on the REST 4 template this is how I register the routes...
// SOAP Endpoint
RouteTable.Routes.Add(new ServiceRoute("myendpointname/soap",
new WindsorServiceHostFactory<Castle.Facilities.WcfIntegration.DefaultServiceModel>(), typeof(IMyEndPointService)));
// REST Endpoint
RouteTable.Routes.Add(new ServiceRoute("myendpointname",
new WindsorServiceHostFactory<RestServiceModel>(), typeof(IMyEndPointService)));
精彩评论