开发者

Should we use overrides or a static constructor when overriding AutofacServiceHostFactory

We are running WCF services with net.tcp bindings in IIS 7.5, so we make use of non-HTTP activations and WAS Hosting. We are have created a custom service host factory for each service, which is derived from AutofacServiceHostFactory

I was recently doing some maintenance on the services (switching to use NuGet packages upgrading to the lates开发者_开发问答t versions, etc). I happened to notice that the wiki article for WCF Integration recommends using an override of CreateServiceHost(string constructorString, Uri[] baseAddresses) and building up the container there before calling the base implementation.

Our ServiceHostFactories have been using a static constructor to do the same thing. I'm wondering if I should switch. Is there a reason a static constructor is a bad idea? If using the overrides, we need to override any of the other overloads for CreateServiceHost().

Thanks for the help!


It appears that the recommendation has changed again to use the AppStart.AppInitialize() to register the dependencies and build the container in a protocol agnostic faction. That's what we're doing now.

Autofac Wiki

Referenced article

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜