我正在使用Castle WCF集成工具,因为我想将我的WCF服务与windsor IOC集成。
我面临的问题是我不能为DefaultServiceHostFactory设置IKernel。
我设置了容器:
container = new WindsorContainer().AddFacility<WcfFacility>();
container.Register(Component.For<DefaultServiceHostFactory>());
container.Register(Component.For<IFoo>().ImplementedBy<Foo>());然后我设置SVC文件:
<%@ ServiceHost
Language="C#"
Debug="true"
Service="Foo"
Factory="Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration"%>当WCF尝试实例化内核时,它会指出kernell为空,并建议使用DefaultServiceHostFactory.RegisterContainer(IKernel DefaultServiceHostFactory )方法。但是,此方法在最新版本的WCF工具中不可用。
任何需要帮助的人!
谢谢
发布于 2012-03-30 17:54:25
弄清楚了,我正在将应用程序部署到windows Azure,并且我使用web角色启动来注册容器(错误!)一旦我将容器设置放入Global.asax文件中,它就开始为IIS和Azure模拟器工作。
https://stackoverflow.com/questions/7930888
复制相似问题