使用时出现以下错误traceReader.InitializeAsReader(connDef, "D:\\trace.tdf");
错误:
2013-07-25 13:59:53,578 [8] 调用目标引发了调用 InitializeAsReaderException 时的调试错误。Microsoft.SqlServer.Management.Trace.SqlTraceException:无法将对象初始化为读取器。---> 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 Microsoft.SqlServer.Management.Trace.TraceServer.InitializeAsReader(ConnectionInfoBase serverConnInfo, String profileFileName) 处的 .InitSource(Boolean bReOpen) --- 内部异常堆栈跟踪结束 --- Microsoft.SqlServer.Management.Trace.TraceServer.InitializeAsReader( ConnectionInfoBase serverConnInfo,
设想:
我在 windows 2008 R2 下使用 sql 2012 服务器。
加载的程序集是
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.
我做错了什么?