我想在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