我想在Windows服务中托管我的WCF服务库。虽然它将通过本地网络与另一个wcf服务进行通信。使用Castle.Windsor 3.0问题作为Windows服务托管的WCF服务库
我很难找到最新的最新文档或帮助为此配置解决方案。任何人都可以提出:
a)这种连接的首选端点是什么? (其他WCF服务使用basicHttpBinding托管) - 这本身很适合通过劫持global.asax配置Castle容器。但是,在Windows服务中托管此解决方案意味着我不再能够访问global.asax!
b)如何配置Castle Windsor以使用DI解决方案?目前我已经考虑将其挂钩到App_Code的AppInitilize()方法以及其他一些不再有效的解决方案。
当前解决方案架构:
*核心(C#类库)
*服务(C#类库)
* WCF SERVICS(WCF服务库)
* Windows服务( Windows服务项目)
AppInitilize()[目前似乎没有工作]的示例代码:
public class WindsorConfiguration
{
public static IWindsorContainer Container { get; private set; }
public static void AppInitialize()
{
{
Container = new WindsorContainer()
.AddFacility<WcfFacility>()
.Register(Component.For<IVirusCheckService>().ImplementedBy<VirusCheckService>()
.LifeStyle.Transient
.AsWcfService(new DefaultServiceModel()
.AddBaseAddresses("http://localhost:8080/MyService")
.AddEndpoints(WcfEndpoint.BoundTo(new BasicHttpBinding())
.At("basic"))
.PublishMetadata(o => o.EnableHttpGet())))
.Register(Component.For<ILoggingService>().ImplementedBy<LoggingService>());
}
}
真的吗?没有人对此有任何建议?!当然这不是那么模糊? – M05Pr1mty 2012-04-10 15:07:51