简体   繁体   English

注册温莎城堡测井设施

[英]Register Castle Windsor Logging Facility

I am new to IOC and Castle Windsor. 我是IOC和温莎城堡的新手。 I would like to use the logging facility provided by Castle per their documentation 我想根据他们的文档使用Castle提供的日志记录工具

http://stw.castleproject.org/Windsor.Logging-Facility.ashx http://stw.castleproject.org/Windsor.Logging-Facility.ashx

I am trying to register the facility per the documentation recommendation 我正在尝试根据文档建议注册该设施

container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithConfig("log4net.config"));

I have referenced the Castle.Core and Castle.Facilities.Logging dll's 我已经引用了Castle.Core和Castle.Facilities.Logging dll的

at compile time I get the following error 在编译时出现以下错误

The type 'Castle.Facilities.Logging.LoggingFacility' cannot be used as type parameter 'T' in the generic type or method 'Castle.Windsor.IWindsorContainer.AddFacility<T>(System.Func<T,object>)'. 
There is no implicit reference conversion from 'Castle.Facilities.Logging.LoggingFacility' to 'Castle.MicroKernel.IFacility'. C:\Sports\app\Daedalsoft.Sports.ApplicationServices\WindsorServiceInstaller.cs

Any help would be much appreciated. 任何帮助将非常感激。

It looks like you may have a reference to Castle.MicroKernel.dll from a previous version. 看起来您可能从以前的版本中引用了Castle.MicroKernel.dll。 Castle.MicroKernel was merged into Castle.Windsor.dll, if you're using the latest version of Windsor you shouldn't have Castle.MicroKernel.dll. Castle.MicroKernel已合并到Castle.Windsor.dll中,如果您使用的是最新版的Windsor,则不应安装Castle.MicroKernel.dll。

Also make sure you have a reference to Castle.Services.Logging.Log4netIntegration.dll and log4net.dll 还要确保您有对Castle.Services.Logging.Log4netIntegration.dll和log4net.dll的引用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM