本文介绍了在WCF服务库项目使用自定义ServiceHostFactory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编程,国内主要依赖于控制反转的WCF服务。我想引导/初始化一个自定义ServiceHostFactory里面我的IoC容器。我读过不同的挂钩可用的一些例子,但他们都不为我工作



这的是一个我宁愿使用(自定义IServiceBehavior接口,IInstanceProvider,ServiceHost的和ServiceHostFactory),但最后一步是通知该服务使用我serivce的* .SVC文件里面我的自定义ServiceHostFactory。我没有那些自项目类型之一,是一个WCF服务库 - 不是一个WCF服务应用程序。有没有一种方法,我可以告诉WCF使用我ServiceHostFactory在App.config文件?


解决方案

由于我没有看到在前面回答,我会后我发现,这是不是很鼓舞人心的。



到SVC文件和工厂属性,这不是什么ServiceHostFactory点的所有引用您正在寻找的。

的的甚至告诉,这是不可能做你想达到什么目的。



对不起...


I'm programming a WCF service that internally relies heavily on Inversion of Control. I would like to bootstrap / initialize my IoC container inside a custom ServiceHostFactory. I've read some examples of different hooks that are available, but none of them seem to work for me.

This approach is the one I'd prefer to use (custom IServiceBehavior, IInstanceProvider, ServiceHost and ServiceHostFactory) but the last step is to signal to the service to use my custom ServiceHostFactory inside my serivce's *.svc-file. I don't have one of those since the project type is a WCF Service Library - not a WCF Service Application. Is there a way I can tell WCF to use my ServiceHostFactory in the App.config file?

解决方案

As I don't see an anwer, I'll post what I found, which is not very encouraging.

All references to ServiceHostFactory point to the svc file and the Factory attribute, which is not what you are looking for.

This thread on MSDN even tells that it is not possible to do what you are trying to achieve.

Sorry...

这篇关于在WCF服务库项目使用自定义ServiceHostFactory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 04:32