注册Castle Windsor采伐设施

时间:2010-12-11 23:57:00

标签: c# asp.net asp.net-mvc-2 castle-windsor castle

我是国际奥委会和温莎城堡的新手。我想使用Castle提供的日志记录工具

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

我正在尝试根据文档建议注册设施

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

我引用了Castle.Core和Castle.Facilities.Logging dll的

在编译时我收到以下错误

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

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:3)

看起来您可能引用了以前版本的Castle.MicroKernel.dll。 Castle.MicroKernel被合并到Castle.Windsor.dll中,如果你使用最新版本的Windsor,你就不应该使用Castle.MicroKernel.dll。

另外请确保您引用了Castle.Services.Logging.Log4netIntegration.dll和log4net.dll