我注意到,當我調用NServiceBus.host.exe上的/ install標誌時,在應用程序事件日誌下創建事件日誌源。麻煩的是,我們已經配置NServiceBus L4N將事件寫入同一個源,但在自定義事件日誌下。NServiceBus登錄到自定義日誌
這會導致一個問題,因爲如果我們我們的自定義事件下創建源登錄安裝失敗(NserviceBus安裝程序將拋出System.ArgumentException:源等等已經存在的本地計算機上)。
那麼我們應該如何阻止NServiceBus安裝程序嘗試在應用程序事件日誌下創建事件源?
我們使用NServiceBus 3.0.1.0
感謝
編輯 - 全堆棧跟蹤
Creating EventLog source blah in log Application...
An exception occurred during the Install phase.
System.ArgumentException: Source blah already exists
on the local computer.
The Rollback phase of the installation is beginning.
Restoring event log to previous state for source blah
.
Service blah is being removed from the system...
Service blah was successfully removed from the system
.
The Rollback phase completed successfully.
Unhandled Exception: System.InvalidOperationException: The installation failed, and the rollback has been performed. ---> System.ArgumentException: Source blah already exists on the local computer.
at System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData)
at System.Diagnostics.EventLogInstaller.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.ServiceProcess.ServiceInstaller.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at Topshelf.Internal.Hosts.HostServiceInstaller.Install(IDictionary stateSaver)
in d:\dev\open-source\topshelf\src\Topshelf\Internal\Hosts\HostServiceInstaller.cs:line 120
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
--- End of inner exception stack trace ---
at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
at Topshelf.Internal.Hosts.HostServiceInstaller.Register() in d:\dev\open-source\topshelf\src\Topshelf\Internal\Hosts\HostServiceInstaller.cs:line 61
at Topshelf.Internal.Actions.InstallServiceAction.Do(IRunConfiguration configuration) in d:\dev\open-source\topshelf\src\Topshelf\Internal\Actions\InstallServiceAction.cs:line 42
at Topshelf.Runner.Host(IRunConfiguration configuration, String[] args) in d:\dev\open-source\topshelf\src\Topshelf\Runner.cs:line 70
at NServiceBus.Hosting.Windows.Program.Main(String[] args) in d:\BuildAgent-03\work\nsb.masterbuild1\src\hosting\NServiceBus.Hosting.Windows\Program.cs:line 122
NServiceBus只記錄到控制檯/文件,所以我非常確定這與實際的日誌記錄無關。我不是100%確定,但我認爲安裝Windows服務時會創建事件源? – 2012-04-10 13:28:14
這可能是頂部自動創建源代碼。我需要深入挖掘 – 2012-04-10 13:31:56
我有完全相同的問題。你有沒有發現是什麼原因造成的? – 2012-12-18 11:52:24