2013-07-25 59 views
4

我得到下面的錯誤,而使用traceReader.InitializeAsReader(connDef, "D:\\trace.tdf");出錯初始化跟蹤讀者

錯誤:

2013-07-25 13:59:53,578 [8] DEBUG Error while invoking InitializeAsReaderException has been thrown by the target of an invocation. Microsoft.SqlServer.Management.Trace.SqlTraceException: Failed to initialize object as reader. ---> System.Runtime.InteropServices.COMException at ?A0xe4daab47.ProcessError(Int32 hr, UInt16* lpszMessage) at Microsoft.SqlServer.Management.Trace.CTraceControllerBase.InitSource(Boolean bReOpen) at Microsoft.SqlServer.Management.Trace.CTraceObjectsRowsetController.InitSource(Boolean bReOpen) at Microsoft.SqlServer.Management.Trace.TraceServer.InitializeAsReader(ConnectionInfoBase serverConnInfo, String profileFileName) --- End of inner exception stack trace --- at Microsoft.SqlServer.Management.Trace.TraceServer.InitializeAsReader(ConnectionInfoBase serverConnInfo, String profileFileName).

場景:加載

I use sql 2012 server under windows 2008 R2.

組件是

connectionInfoAssembly = Assembly.Load("Microsoft.SqlServer.ConnectionInfo, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"); 
traceAssembly = Assembly.Load("Microsoft.SqlServer.ConnectionInfoExtended, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"); 
smoAssembly = Assembly.Load("Microsoft.SqlServer.Smo, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"); 

ConnInfo是

server='';Trusted_Connection=true;multipleactiveresultsets=false --- Database name. 

什麼,我做錯了什麼?

+1

您在DEBUG記錄錯誤? – Amy

回答

2

I figured out the issue.

我使用WiX的工具來創建MSI和部署此項目(跟蹤閱讀器)作爲windows.What服務中發生的事情是,跟蹤讀者服務與本地系統account.This帳戶下運行沒有足夠的特權訪問痕跡。

我已經爲LocalSystem啓用了「改變跟蹤」權限,如下所示。 enter image description here

當您將項目部署爲服務時,這是必需的。