我正在尝试将NLog与Rebus一起使用,但我得到了一个异常:无法访问类型为:Rebus.Configuration.RebusConfigurer的构造函数。是否授予了所需的权限?
adapter.Register(() => new DownloadHandler());
Configure.With(adapter)
.Logging(l => l.NLog())
.Transport(t => t.UseMsmq("my.input", "my.error"))
.CreateBus()
.Start();有什么线索吗?
为了澄清,两个包都是0.32.3,而stacktrace是:
at NLog.Internal.FactoryHelper.CreateInstance(Type t)
at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey)
at NLog.LogFactory.GetLogger(String name, Type loggerType)
at NLog.LogManager.GetCurrentClassLogger(Type loggerType)
at Rebus.NLog.NLogLoggerFactory.GetLogger(Type type)
at Rebus.Logging.AbstractRebusLoggerFactory.GetCurrentClassLogger()
at Rebus.Configuration.RebusConfigurer.<.cctor>b__0(IRebusLoggerFactory f)
at Rebus.Logging.RebusLoggerFactory.<>c__DisplayClass1.<set_Current>b__0(Action`1 h)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Rebus.Logging.RebusLoggerFactory.set_Current(IRebusLoggerFactory value)
at Rebus.Configuration.ConfigurationBackbone.set_LoggerFactory(IRebusLoggerFactory value)
at Rebus.Configuration.LoggingConfigurer.Use(IRebusLoggerFactory loggerFactory)
at Rebus.NLog.NLogLoggingExtension.NLog(LoggingConfigurer configurer)
at OpenTokDownloader.OpenTokDownloader.<Start>b__2(LoggingConfigurer l) in H:\Test\Downloader.cs:line 28
at Rebus.Configuration.RebusConfigurerWithLogging.Logging(Action`1 configurer)
at OpenTokDownloader.OpenTokDownloader.Start() in H:\Test\Downloader.cs:line 27
at OpenTokDownloader.Program.<Main>b__3(OpenTokDownloader tc) in H:\Test\Downloader\Program.cs:line 19
at Topshelf.ServiceConfiguratorExtensions.<>c__DisplayClass7`1.<WhenStarted>b__6(T service, HostControl control)
at Topshelf.Builders.DelegateServiceBuilder`1.DelegateServiceHandle.Start(HostControl hostControl)
at Topshelf.Hosts.ConsoleRunHost.Run()发布于 2013-05-29 02:42:21
原来Rebus的NLogLoggerFactory中有一个bug,会导致它请求NLog尝试实例化并使用RebusConfigurer作为记录器……正如您所经历的,这是不可能做到的:)
我已经修复了这个错误,所以如果你在你的解决方案中update-packages Rebus.NLog,你应该是很好的!
感谢您报告此问题!
https://stackoverflow.com/questions/16770205
复制相似问题