Error initializing trace reader

I get the following error when using traceReader.InitializeAsReader(connDef, "D:\\trace.tdf");

Error:

2013-07-25 13: 59: 53,578 [8] DEBUG error while calling InitializeAsReaderException the target of the call was selected. Microsoft.SqlServer.Management.Trace.SqlTraceException: Failed to initialize the object as a reader. ---> System.Runtime.InteropServices.COMException in? A0xe4daab47.ProcessError (Int32 hr, UInt16 * lpszMessage) at Microsoft.SqlServer.Management.Trace.CTraceControllerBase.InitSource (Boolean bReOpen) at Microsoft.SqlServer.Management.Trace.CTraceObjectsRowserlerolControl Trace.TraceServer.InitializeAsReader (ConnectionInfoBase serverConnInfo, String profileFileName) --- End of internal exception stack trace --- with Microsoft.SqlServer.Management.Trace.TraceServer.InitializeAsReader (ConnectionInfoBase serverConnInfo, String profileFileName).

Scenario:

I am using sql 2012 server under windows 2008 R2.

Loaded builds:

 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. 

what am I doing wrong?

+4
source share
1 answer

I understood the problem.

I am using a wix tool to create msi and deploy this project (Trace reader) as a service on Windows. What happens is the trace tracking service works with the LocalSystem account. This account does not have sufficient privileges to access the tracks.

I have enabled the "Alter trace" permission for LocalSystem, as shown below. enter image description here

This is required when deploying the project as a service.

+2
source

Source: https://habr.com/ru/post/1493393/


All Articles