2013-05-27 48 views
1

我正在嘗試將NLog與Rebus一起使用,但我收到一個異常:無法訪問類型爲:Rebus.Configuration.RebusConfigurer的構造函數。是否授予必需的許可?Nlog的Rebus配置

adapter.Register(() => new DownloadHandler()); 

      Configure.With(adapter) 
       .Logging(l => l.NLog()) 
       .Transport(t => t.UseMsmq("my.input", "my.error")) 
       .CreateBus() 
       .Start(); 

任何線索?

爲了澄清這兩個包是0.32.3和堆棧跟蹤是:

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() 
+0

您使用的是Rebus和Rebus.NLog的哪個版本?這聽起來像是我的版本不匹配... 如果你提供的版本(可以在你的'packages.config'中找到)和異常的完整堆棧跟蹤,我將很樂意幫助:) – mookid8000

+0

嗨,我提供了你請求的信息。 – gmav

回答

0

原來有在滷麪NLogLoggerFactory一個錯誤,會導致它要求NLOG嘗試實例化並使用RebusConfigurer作爲一個記錄器...正如你所經歷的,那是不可能完成的:)

我已經修復了這個bug,所以如果你在你的解決方案中使用update-packages Rebus.NLog,你應該很好走!

感謝報告此問題!

+0

也感謝您的幫助。 – gmav