服務追蹤檢視器工具 (SvcTraceViewer.exe)Service Trace Viewer Tool (SvcTraceViewer.exe)

Windows Communication Foundation (WCF)服務追蹤檢視器工具可協助您分析 WCF 所產生的診斷追蹤。Windows Communication Foundation (WCF) Service Trace Viewer Tool helps you analyze diagnostic traces that are generated by WCF. 服務追蹤檢視器提供一種方法,可讓您輕鬆地在記錄檔中合併、查看和篩選追蹤訊息,以便您診斷、修復和驗證 WCF 服務問題。Service Trace Viewer provides a way to easily merge, view, and filter trace messages in the log so that you can diagnose, repair, and verify WCF service issues.

設定追蹤Configuring Tracing

診斷追蹤可提供您資訊,顯示整個應用程式的作業期間所發生之事件。Diagnostic traces provide you with information that shows what is happening throughout your application's operation. 顧名思義,您可以從作業的來源開始追蹤,一直追蹤到作業的目的端,也可以透過中繼點追蹤。As the name implies, you can follow operations from their source to destination and through intermediate points as well.

您可以使用應用程式的設定檔(Web 裝載應用程式的 web.config,或自我裝載應用程式的Appname.config)來設定追蹤。You can configure tracing using the application’s configuration file—either Web.config for Web-hosted applications, or Appname.config for self-hosted applications. 以下是一個範例:The following is an example:

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
            <source name="System.ServiceModel"
                    switchValue="Information, ActivityTracing"
                    propagateActivity="true">
            <listeners>
               <add name="sdt"
                   type="System.Diagnostics.XmlWriterTraceListener"
                   initializeData= "SdrConfigExample.e2e" />
            </listeners>
         </source>
    </sources>
</system.diagnostics>

在這個範例中,指定了追蹤接聽項的名稱與型別。In this example, the name and type of the trace listener is specified. 接聽項命名為 sdt,而標準 .NET Framework 追蹤接聽項 (System.Diagnostics.XmlWriterTraceListener) 會當成型別加入。The Listener is named sdt and the standard .NET Framework trace listener (System.Diagnostics.XmlWriterTraceListener) is added as the type. @No__t_0 屬性是用來設定要 SdrConfigExample.e2e 之接聽程式的記錄檔名稱。The initializeData attribute is used to set the name of the log file for that Listener to be SdrConfigExample.e2e. 對於記錄檔,您可以使用完整路徑來取代簡單檔名。For the log file, you can substitute a fully-qualified path for a simple file name.

範例會在根目錄中建立名為 SdrConfigExample.e2e 的檔案。The example creates a file in the root directory called SdrConfigExample.e2e. 當您使用追蹤檢視器來開啟檔案(如「開啟和流覽 WCF 追蹤檔案」一節中所述)時,您可以看到所有已傳送的訊息。When you use the Trace Viewer to open the file as described in the "Opening and Viewing WCF Trace Files" section, you can see all the messages that have been sent.

追蹤層級是由 switchValue 設定所控制。The tracing level is controlled by the switchValue setting. 下表描述可使用的追蹤層級。The available tracing levels are described in the following table.

追蹤層級Trace Level 描述Description
CriticalCritical -記錄「失敗-快速」和「事件記錄檔」專案,以及追蹤相互關聯資訊。- Logs Fail-Fast and Event Log entries, and trace correlation information. 以下為一些會使用到「嚴重」層級的範例:The following are some examples of when you might use the Critical level:
-因為發生未處理的例外狀況,所以您的 AppDomain 已關閉。- Your AppDomain went down because of an unhandled exception.
-您的應用程式無法啟動。- Your application fails to start.
-造成失敗的訊息源自進程 MyApp。- The message that caused the failure originated from the process MyApp.exe.
錯誤Error -記錄所有例外狀況。- Logs all exceptions. 您可以在下列情況使用「錯誤」層級:You can use the Error level in the following situations:
-因為轉換例外狀況無效,所以您的程式碼損毀。- Your code crashed because of an Invalid Cast Exception.
-「無法建立端點」例外狀況會導致您的應用程式在啟動時失敗。- A "failed to create endpoint" exception is causing your application to fail on startup.
警告Warning -存在可能會導致錯誤或嚴重失敗的狀況。- A condition exists that may subsequently result in an error or critical failure. 您可以在下列情況使用這個層級:You can use this level in the following situations:
-應用程式收到的要求超過其節流設定所允許的數量。- The application is receiving more requests than its throttling settings allows.
-接收的佇列是其設定容量的 98%。- The receiving queue is at 98 percent of its configured capacity.
內容Information -會產生有助於監視和診斷系統狀態、測量效能或分析的訊息。- Messages helpful for monitoring and diagnosing system status, measuring performance, or profiling are generated. 您可以使用此類資訊來進行容量規劃與效能管理。You can utilize such information for capacity planning and performance management. 您可以在下列情況使用這個層級:You can use this level in the following situations:
-在訊息到達 AppDomain 並還原序列化之後發生失敗。- A failure occurred after the message reached the AppDomain and was deserialized.
-建立 HTTP 系結時發生失敗。- A failure occurred while the HTTP binding was being created.
詳細資訊Verbose -使用者程式碼和服務的調試層級追蹤。- Debug-level tracing for both user code and servicing. 設定這個層級的時機:Set this level when:
-當發生失敗時,您不確定程式碼中的哪一個方法被呼叫。- You are not sure which method in your code was called when the failure occurred.
-您設定的端點不正確,且服務無法啟動,因為保留存放區中的專案已鎖定。- You have an incorrect endpoint configured and the service failed to start because the entry in the reservation store is locked.
ActivityTracingActivityTracing 介於處理活動與元件之間的流程事件。Flow events between processing activities and components.

這個層級可以讓系統管理員與開發人員相互關聯相同應用程式定義域中的多個應用程式。This level allows administrators and developers to correlate applications in the same application domain.

-活動界限的追蹤:啟動/停止。- Traces for activity boundaries: start/stop.
-傳輸的追蹤。- Traces for transfers.

您可以使用 add 來指定要使用的追蹤接聽項名稱與型別。You can use add to specify the name and type of the trace listener you want to use. 在範例組態中,接聽項命名為 sdt,而標準 .NET Framework 追蹤接聽項 (System.Diagnostics.XmlWriterTraceListener) 會當成型別加入。In the example configuration, the Listener is named sdt and the standard .NET Framework trace listener (System.Diagnostics.XmlWriterTraceListener) is added as the type. 請使用 initializeData 來設定該接聽項的記錄檔名稱。Use initializeData to set the name of the log file for that Listener. 此外,您可以使用完整路徑來取代簡單檔名。In addition, you can substitute a fully-qualified path for a simple file name.

從 .NET Framework 4.8 開始,某些高對比主題中的 ComboBox 控制項會以正確的色彩顯示。Starting in .NET Framework 4.8, ComboBox controls in some high contrast themes are displayed in the correct color. 您可以從svctraceviewer.exe中移除下列設定,以停用這項變更:You can disable this change by removing the following setting from the svcTraceViewer.exe.config file:

<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false" />

使用服務追蹤檢視器工具Using the Service Trace Viewer Tool

開啟和檢視 WCF 追蹤檔案Opening and Viewing WCF Trace Files

服務追蹤檢視器支援三種檔案類型:The Service Trace Viewer supports three file types:

  • WCF 追蹤檔案(. .Svclog)WCF Tracing File (.svcLog)

  • 事件追蹤檔 (.etl)Event Tracing File (.etl)

  • Crimson 追蹤檔Crimson Tracing File

服務追蹤檢視器可讓您開啟所有支援的追蹤檔、新增並整合其他追蹤檔,或者同時開啟與合併一組追蹤檔。Service Trace Viewer enables you to open any supported trace file, add and integrate additional trace files, or open and merge a group of trace files simultaneously.

若要開啟追蹤檔To open a trace file
  1. 使用 [命令視窗] 流覽至您的 WCF 安裝位置(C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin),然後輸入 SvcTraceViewer.exe,以啟動服務追蹤檢視器。Start Service Trace Viewer by using a command window to navigate to your WCF installation location (C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin), and then type SvcTraceViewer.exe.

注意

服務追蹤檢視器工具可以和兩種檔案類型產生關聯:.svclog 與 .stvproj。The Service Trace Viewer tool can associate with two file types: .svclog and .stvproj. 您可以在命令列中使用兩個參數來註冊與取消註冊檔案的副檔名。You can use two parameters in command line to register and unregister the file extensions.

/register:註冊 ".svclog" 和 ".stvproj" 副檔名與 SvcTraceViewer.exe 之間的關聯。/register: register the association of file extensions ".svclog" and ".stvproj" with SvcTraceViewer.exe

/unregister:移除註冊 ".svclog" 與 ".stvproj" 副檔名與 SvcTraceViewer.exe 之間的關聯。/unregister: unregister the association of file extensions ".svclog" and ".stvproj" with SvcTraceViewer.exe

  1. 當服務追蹤檢視器啟動時 ,按一下 [ 檔案],然後指向 [開啟]。When Service Trace Viewer starts, click File and then point to Open. 巡覽至您的追蹤檔案存放的位置。Navigate to the location where your trace files are stored.

  2. 按兩下您要開啟的追蹤檔案。Double-click the trace file that you want to open.

    注意

    按下 SHIFT 鍵並同時按一下多個追蹤檔案,以便同時選取並開啟多個檔案。Press SHIFT while clicking multiple trace files to select and open them simultaneously. 服務追蹤檢視器會將所有檔案的內容合併為單一檢視。Service Trace Viewer merges the content of all files and presents one view. 例如,您可以同時開啟用戶端與服務的追蹤檔案。For example, you can open trace files of both client and service. 當您在組態中啟用了訊息記錄與活動傳播時,這將會很有用。This is useful when you have enabled message logging and activity propagation in configuration. 這樣一來,您就可以檢查用戶端與服務之間的訊息交換。In this way, you can examine message exchange between client and service. 您也可以將多個檔案拖曳到檢視器中,或使用 [專案] 索引標籤。如需詳細資訊,請參閱管理專案一節。You can also drag multiple files into the viewer, or use the Project tab. See the Managing Project section for more details.

  3. 若要將其他追蹤檔案新增至已開啟的集合,請按一下 [ 檔案],然後指向 [新增]。To add additional trace files to the collection that is open, click File and then point to Add. 在開啟的視窗中,巡覽至追蹤檔的位置並按兩下您要新增的檔案。In the window that opens, navigate to the location of the trace files and double-click the file you want to add.

警告

不建議您載入大於 200MB 的追蹤記錄檔。It is not recommended that you load a trace log file bigger than 200MB. 如果嘗試載入大於這項限制的檔案,載入程序可能會花費很長的時間 (視您電腦的資源而定)。If you attempt to load a file larger than this limit, the loading process may take a long time, depending on your computer resource. 服務追蹤檢視器工具不是造成需花費這麼長時間的原因,但它可能會耗盡電腦的記憶體。The Service Trace Viewer tool may not be responsive for a long time, or it may exhaust your machine's memory. 建議您設定部分載入,以避免發生這種狀況。It is recommended that you configure partial loading to avoid this. 如需如何執行此作業的詳細資訊,請參閱「載入大型追蹤檔」一節。For more information on how to do this, see "Loading Large Trace Files" section.

事件追蹤與 Crimson 追蹤Event Tracing and Crimson Tracing

檢視器的原生格式是 WCF 發出的活動追蹤格式。The viewer’s native format is the activity tracing format that WCF emits. 以不同格式發出的追蹤資料必須先經過轉換,才能透過檢視器加以顯示。Traces emitted in a different format must be converted before the viewer displays them. 除了活動追蹤格式之外,目前的檢視器還支援事件追蹤和 Crimson 追蹤。Currently, in addition to the activity tracing format, the viewer supports event tracing and crimson tracing.

當您開啟不包含活動追蹤的檔案時,檢視器會嘗試轉換檔案。When you open a file that does not contain activity traces, the viewer attempts to convert the file. 您必須指定將包含已轉換追蹤資料之檔案的名稱與位置。You must specify the name and location of the file that will contain the converted trace data. 一旦資料轉換完畢,檢視器就會顯示新檔案的內容。Once the data has been converted, the viewer displays the content of the new file.

注意

轉換時需要使用磁碟空間來儲存轉換的追蹤資料。Conversion requires disk space to store the converted trace data. 在開始轉換之前,請先確定您擁有足夠的磁碟空間來儲存資料。Make sure you have enough disk space available to store the data before you start a conversion. 否則,轉換會失敗。Otherwise, the conversion fails.

管理專案Managing Projects

檢視器支援專案以協助檢視多個追蹤檔案。The viewer supports projects to facilitate viewing multiple trace files. 例如,如果您擁有一個用戶端追蹤檔與一個服務追蹤檔,則您可以將它們新增至專案中。For example, if you have a client trace file and a service trace file, you can add them to a project. 之後,每次當您開啟專案時,就會同時載入專案中的所有追蹤檔。Then, every time you open the project, all the trace files in the project are loaded simultaneously.

有兩種方式管理專案:There are two ways to manage projects:

  • 在 [檔案] 功能表中,您可以開啟、儲存和關閉專案。In the File menu, you can open, save and close projects.

  • 在 [專案] 索引標籤中,您可以將檔案加入至專案。In the Project tab, you can add files to a project.

檢視 WCF 追蹤Viewing WCF Traces

WCF 會使用活動追蹤格式來發出追蹤。WCF emits traces using the activity tracing format. 在活動追蹤模型中,個別追蹤會依其用途分為不同的活動群組。In the activity tracing model, individual traces are grouped in activities according to their purpose. 邏輯控制流程會在活動之間傳輸。Logical control flow is transferred between activities. 例如,在應用程式的存留期內,會出現許多「訊息傳送活動」然後消失。For example, during the lifetime of an application, many "message send activities" appear and disappear. 如需有關查看追蹤和活動以及服務追蹤檢視器之使用者介面的詳細資訊,請參閱使用服務追蹤檢視器來查看相互關聯的追蹤和疑難排解For more information on viewing traces and activities, and the user interface of the Service Trace Viewer too, see Using Service Trace Viewer for Viewing Correlated Traces and Troubleshooting.

切換至不同的檢視Switching to Different Views

服務追蹤檢視器可提供不同的檢視,The Service Trace Viewer provides the following different views. 它們會在檢視器的左窗格中顯示為索引標籤,也可以從 [ View ] 功能表存取。They are displayed as tabs on the left pane of the Viewer, and can also be accessed from the View menu.

  • 活動檢視Activity View

  • 專案檢視Project View

  • 訊息檢視Message View

  • 圖形檢視Graph View

活動檢視Activity view

開啟追蹤檔案之後,您可以看到群組為活動的追蹤,並顯示在左側窗格的 [活動] 視圖中。Once the trace files are opened, you can see the traces grouped into activities and displayed in the Activity view in the left-hand pane.

[活動] 視圖會顯示活動名稱、活動中的追蹤數目、持續時間、開始時間和結束時間。The Activity view displays activity names, number of traces in the activity, duration time, start time and end time.

只要按一下任何一項列出的活動,此活動的追蹤就會顯示在右側的追蹤窗格中,By clicking any of the listed activities, the traces in this activity are displayed in the trace pane on the right. 然後您可以選取追蹤以檢視其詳細資料。You can then select a trace to view its details.

您可以藉由按下CtrlShift鍵,然後按一下所需的活動,來選取多個活動。You can select multiple activities by pressing the Ctrl or Shift key and clicking the desired activities. 追蹤窗格會顯示選取之活動的所有追蹤。The trace pane displays all the traces of the selected activities.

您可以按兩下活動,將其顯示在圖表視圖中。You can double-click an activity to display it in Graph View. 另一種方式是選取活動並切換至圖表視圖。The alternative way is to select an activity and switch to Graph View.

注意

活動 "000000000000" 是無法在圖形視圖中顯示的特殊活動。The activity "000000000000" is a special activity that cannot be displayed in the Graph View. 由於其他所有活動皆連結至這個活動,所以如果顯示這個活動,將對效能產生嚴重的影響。Because all other activities are linked to it, displaying this activity has a severe performance impact.

您可以按一下資料行標題,將活動清單排序。You can click the column title to sort the activity list. 包含警告追蹤的活動背景為黃色,而包含錯誤追蹤的活動背景則為紅色。Activities that contain warning traces have a yellow background and those that contain error traces have a red one.

活動的類型各有不同,而每種類型都會對應至每個活動左側的某個圖示。There are different types of activities and each type corresponds to an icon on the left side of each activity. 如需這些圖示的意義,請參閱「了解追蹤圖示」一節。You can refer to the Understanding Trace Icons section for their meaning.

專案檢視Project View

這個檢視可讓您管理目前專案中的追蹤檔案。This view enables you to manage trace files in the current project. 如需詳細資訊,請參閱<管理專案>一節。See the Managing Project section for more details.

訊息檢視Message View

這個視圖可讓您查看所有的訊息記錄追蹤,包括動作、日期/時間、處理常式、活動和 From/To,以及流覽至相關聯訊息記錄追蹤的詳細資料。This view enables you to view all message log traces, including Action, Date/Time, Process, Acivity and From/To, and navigate to the details of the associated message log trace. 您可以依據活動界限、進程/執行緒或傳送 & 接收來分組訊息記錄追蹤,以便更輕鬆地流覽訊息流程。You can group the message log traces by Activity Boundary, Process/Thread, or Send & Receive for easier navigation of the message flow.

圖形檢視Graph View

此視圖會以圖表形式顯示給定活動的追蹤資料。This view displays the trace data for a given activity in chart form. 圖表格式可讓您看見事件以階段的方式執行,以及當資料在多個活動之間移動時,這些活動之間的關係。The chart form enables you to see the stepwise execution of events and the interrelationships between multiple activities as data moves between them.

若要切換至圖形視圖,請在 [活動] 視圖中選取活動,然後按一下 [活動] 索引標籤,或訊息視圖中的訊息記錄追蹤。To switch to Graph view, select an activity in the Activity view and click the Activity tab, or a message log trace in the Message View. 如果載入了多個追蹤檔案,而且活動涉及來自一個檔案以上的追蹤,則圖形檢視會顯示所有相關的追蹤。If multiple trace files are loaded and the activity involves traces from more than one file, all of the relevant traces appear in the graph view. 按兩下 [活動] 和 [訊息記錄檔追蹤] 也會引導您前往圖表視圖。Double-clicking on the activities and message log traces also leads you to the Graph view.

圖表視圖中,每個垂直資料行都代表一個活動,而資料行中的每個區塊都代表一個追蹤。In Graph view, each vertical column represents an activity, and each block in the column represents a trace. 所有活動會依處理序 (或執行緒) 分組。The activities are grouped by process (or thread). 活動之間的小箭頭代表傳輸,The small arrows between activities represent transfers. 處理序之間的大箭頭則代表訊息交換。The big arrows between processes represent message exchange. 選取的活動一律會以黃色表示。The activity in selection is always in yellow.

選取圖形中的追蹤Selecting Traces in the Graph
  1. 按一下圖形中的區塊。Click a block in the graph.

  2. 使用向上與向下鍵來選取相鄰的追蹤。Use the up and down keys to select its neighboring traces.

  3. 觀察 [追蹤窗格] 與 [詳細資料窗格] 中的追蹤資訊。Observe the trace information in the Trace Pane and Detail Pane.

展開或摺疊活動傳輸Expanding or Collapsing Activity Transfers

當選取的活動向外傳輸至另一個活動中時,您可以展開活動傳輸,You can expand activity transfers when the activity in selection transfers out to another activity. 這可讓您追蹤傳輸。It enables you to follow the transfers.

若要展開或摺疊活動傳輸,To expand or collapse activity transfers,

  1. 使用傳輸圖示左邊的 "+" 符號來尋找傳輸追蹤。Locate the transfer trace with a "+" sign on the left of the transfer icon.

  2. 按一下 [+],或按Ctrl鍵和 "+" (使用鍵盤)。Click the "+", or press Ctrl and "+" using the keyboard.

  3. 下一個活動隨即會出現在圖形中。The next activity appears in the graph.

  4. [-] 會出現在傳輸圖示的左邊。A "-" appears on the left of the transfer icon. 按一下 [-] 符號,或按 Ctrl 和 "-",活動傳輸會折迭。Click the "-" sign or press Ctrl and "-", the activity transfer collapses.

注意

當多個傳輸進入某個活動,而且您展開其中一個傳輸,則會顯示從根活動到新活動之間的所有活動。When an activity has multiple transfers into it and you expand one of the transfers, activities that lead up to the new activity from the root activity are displayed. 這些新的活動會以摺疊形式顯示。These new activities appear in collapsed form. 如果您想要查看這些活動的詳細資料,可以按一下圖形標頭的展開圖示,垂直展開這些活動。If you want to see the details of these activities, expand them vertically by clicking the expand icon in the header of the graph.

垂直展開或摺疊活動Expanding or Collapsing Activities Vertically

檢視器會藉由摺疊活動來隱藏活動圖形中不必要的詳細資料。The viewer hides unnecessary detail in the activity graph by collapsing activities. 在摺疊的活動中,不會顯示個別的追蹤,In a collapsed activity, individual traces are not displayed. 只會顯示傳輸追蹤。Only transfers trace appear. 如果您想要檢視活動中的所有追蹤,可以按一下圖形標題的活動展開符號,垂直展開活動。If you want to view all traces in an activity, expand the activity vertically by clicking the expand symbol of the activity in the header of the graph.

若要垂直展開或摺疊活動,To expand or collapse activities vertically,

  1. 按一下活動標頭中的 [+] 圖示,以垂直方式展開活動。Click the "+" icon in the activity header to expand the activity vertically.

  2. 請注意,圖形會顯示所有的追蹤。Notice that all traces are displayed in the graph.

  3. 按一下活動標頭中的 [-] 圖示,垂直折迭活動。Click the "-" icon in the activity header to collapse the activity vertically.

  4. 請注意,活動中只會顯示重要的傳輸、訊息記錄、警告與例外狀況追蹤。Notice that only important transfers, message logs, warning and exception traces are shown in the activity.

選項Options

您可以從 [圖形視圖] 的 [選項] 功能表中選取兩個選項。You can select two options from the Option menu in Graph view.

  • 顯示活動界限追蹤:取消核取此選項時,即可忽略圖形中的活動界限追蹤。Show Activity Boundary Traces, which when unchecked ignore the activity boundary traces in the graph.

  • 顯示非訊息詳細資訊追蹤:取消核取此選項時,即可忽略詳細資訊層級追蹤 (訊息追蹤除外)。Show Non-message Verbose Traces, which when unchecked ignore verbose level traces, except for message traces. 在大多數情況下,詳細資訊層級追蹤的分析比較不重要。In most cases, verbose level traces are less important for analysis. 當您不想要分析詳細資訊層級追蹤,只想要專注在更重要的追蹤時,這個選項就會很有用。This option is helpful when you do not want to analyze verbose level traces and only want to focus on more important traces.

配置模式Layout Mode

檢視器有兩種配置模式: [處理] 和 [執行緒]。The viewer has two Layout Modes: Process and Thread. 這個設定會定義最大的組織單元。This setting defines the largest unit of organization. 預設的版面配置模式為 [進程],表示活動會依圖表中的進程分組。The default Layout Mode is Process, which means that activities are grouped by processes in the graph.

執行清單Execution List

您可以從這個下拉式清單選取要顯示在圖形中的處理序或執行緒。You can select which process or thread to be displayed in the graph from this drop-down list. 例如,如果您有兩個用戶端 (A 與 B) 的追蹤檔,並且開啟了一個服務,但只想要在圖形中顯示服務與用戶端 A,則可以取消選取清單中的用戶端 B。For example, if you have the trace files of two clients (A and B) and one service opened, and you only want to display the service and client A in the graph, you can deselect client B from the list.

檢視追蹤詳細資料Viewing Trace Details

若要檢視追蹤詳細資料,請在 [追蹤] 窗格中選取一項追蹤。To view a trace detail, select a trace in the Trace pane. 詳細資料會顯示在 [詳細資料] 窗格中。The details are displayed in the Detail pane.

追蹤窗格Trace Pane

[追蹤窗格] 位於服務追蹤檢視器的右上角,The upper right pane in the Service Trace Viewer is the Trace Pane. 這個窗格會列出選取之活動中的所有追蹤,並且列出追蹤層級、執行緒 ID、處理序名稱等額外的資訊。It lists all the traces in the selected activity with extra information, for example, trace level, thread ID, and process name.

您可以用滑鼠右鍵按一下追蹤並選取 [將追蹤複製到剪貼簿],將追蹤的原始 XML 複製到剪貼簿。You can copy the raw XML of the trace to the clipboard by right-clicking a trace and selecting Copy Trace to Clipboard.

詳細資料窗格Detail Pane

[詳細資料窗格] 位於服務追蹤檢視器的左下角,The bottom left pane in the Service Trace Viewer is the Detail Pane. 這個窗格提供三個用來檢視追蹤詳細資料的索引標籤。It provides three tabs to view trace details.

格式化的視圖會以更有條理的方式顯示資訊。The Formatted view displays the information in a more organized way. 這種檢閱會在表格和樹狀目錄中列出所有已知的 XML 項目,讓這些資訊更容易閱讀與了解。It lists all known XML elements in tables and trees, making it easier to read and understand the information.

Xml視圖會顯示對應于所選追蹤的 xml。The XML view displays XML corresponding to the selected trace. 這種檢視支援反白顯示功能與語法色彩。It supports highlighting and syntax color. 當您使用 [尋找] 搜尋字串時,它會反白顯示搜尋結果。When you use Find to search strings, it highlights the search results.

訊息視圖會顯示訊息記錄檔追蹤中 XML 的訊息部分。The Message view displays the message part of the XML in message log traces. 當您選取非訊息追蹤時,這種檢視就不會出現。It is invisible when you select a non-message trace.

篩選 WCF 追蹤Filtering WCF Traces

為了更輕鬆地分析追蹤,您可以使用下列方式來篩選:To make the analysis of trace easier, you can filter them in the following ways:

  • 篩選器工具列可讓您存取預先定義和自訂的篩選器。The filter toolbar provides access to pre-defined and custom filters. 您可以透過 [ View ] 功能表來啟用它。It can be enabled through the View menu.

  • 您可以使用檢視器預先定義的篩選器,選擇性地篩選 WCF 追蹤的各個部分。The pre-defined filter of the viewer can be used to selectively filter parts of the WCF traces. 根據預設,這個篩選器會允許所有的基礎結構追蹤通過。By default, it is set to allow all infrastructure traces to pass through. 此篩選器的設定是在 [流覽] 功能表底下的 [篩選選項] 子功能表中定義。The settings of this filter are defined in the Filter Options sub-menu under View menu.

  • [自訂 XPath] 篩選器可讓使用者完整控制整個篩選過程。Custom XPath filters give users full control over filtering. 您可以在 [流覽] 功能表底下的自訂篩選器中定義它們。They can be defined in the Custom Filter under View menu.

只有通過所有篩選器的追蹤資料會顯示出來。Only traces that passes through all filters is displayed.

使用篩選器工具列Using the Filter Toolbar

篩選器工具列會出現在工具的上方。The filter toolbar appears across the top of the tool. 如果不存在,您可以在 [ View ] 功能表中啟動它。If it is not present, you can activate it in the View menu. 工具列內含三個元件:The bar has three components:

  • 尋找: [尋找] 會定義要在篩選作業中尋找的主旨。Look for: Look for defines the subject to look for in the filter operation. 例如,如果您想要尋找在進程 X 內容中發出的所有追蹤,請將此欄位設定為 X,並將 [搜尋輸入] 欄位設為 [進程名稱]。For example, if you want to find all traces that were emitted in the context of process X, set this field to X and the Search In field to ‘Process Name’. 當您選取了以時間為基礎的篩選器時,這個欄位就會變更為 DateTime 選取器控制項。This field changes to a DateTime selector control when a time-based filter is selected.

  • 搜尋:這個欄位會定義要套用的篩選器型別。Search in: This field defines the type of filter to apply.

  • 層級:層級設定定義了篩選器所允許的最小追蹤層級。Level: The level setting defines the minimum trace level allowed by the filter. 例如,如果層級設為 [錯誤與更高層級],則只會顯示 [錯誤] 與 [嚴重] 層級的追蹤。For example, if the level is set to Error and Up, only traces at the Error and critical level are displayed. 這個篩選器會結合 [尋找目標] 與 [搜尋] 指定的準則。This filter combines with the criteria specified by Look For and Search In.

[立即篩選] 按鈕會啟動篩選作業。The Filter Now button starts the filter operation. 有一些篩選器,特別是當它們套用到大型資料集時,會花較長的時間來完成。Some filters, especially when they are applied to a large data set, take a long time to complete. 您可以按下 [作業] 功能表底下狀態列中的 [停止] 按鈕來取消篩選作業。You can cancel the filter operation by pressing the Stop button that appears in the status bar under the Operations menu.

[清除] 按鈕會重設預先定義和自訂篩選準則,以允許所有追蹤通過。The Clear button resets pre-defined and custom filters to allow all traces to pass through.

篩選選項:Filter Options

檢視器會自訂移除檢視中的 WCF 追蹤。The viewer can automatically remove WCF traces from the view. 它會選擇性地移除由 WCF 特定區域所發出的追蹤,例如,從檢視中移除與交易相關的追蹤。It can selectively remove traces emitted by specific areas of WCF, for example, removing transaction related traces from the view.

此篩選器的設定是在 [流覽] 功能表底下的 [篩選選項] 子功能表中定義。The settings of this filter are defined in the Filter Options sub-menu under View menu.

自訂篩選器Custom Filters

如果您很熟悉 XML 路徑語言 (XPath),可以使用它來建構自訂篩選器,以便在追蹤資料中搜尋任何您感興趣的 XML 項目。If you are familiar with the XML Path Language (XPath), you can use it to construct custom filters to search the trace data for any XML element of interest. 這些篩選器都可以透過篩選器工具列加以存取。The filters are accessible through the filter toolbar.

自訂篩選器可包含一些參數。Custom filters can include parameters. 您也可以匯入預先存在的自訂篩選器。You can also import pre-existing custom filters.

建立自訂篩選器Creating a custom filter

您可以用兩種方式來建立篩選器:Filters can be created in two ways:

使用範本精靈來建立自訂篩選器Creating a Custom Filter using the Template Wizard

您可以按一下現有的追蹤,依據追蹤結構來建立篩選器。You can click an existing trace and create a filter based on the structure of the trace. 此範例將以執行緒 ID 為基礎建立一個自訂篩選器。This example creates a custom filter based on thread ID.

  1. 在檢視器右上方的追蹤窗格中,選取一個包含您要篩選之項目的追蹤。In the trace pane in the top right area of the viewer, select a trace that includes the element you want to filter for.

  2. 按一下位於 [追蹤] 窗格頂端的 [建立自訂篩選] 按鈕。Click the Create Custom Filter button located at the top of the trace pane.

  3. 在隨即出現的對話方塊中,輸入篩選器名稱。In the dialog box that appears, enter a name for your filter. 在此範例中,請輸入 Thread IDIn this example, enter Thread ID. 您也可以為自己的篩選器提供說明。You can also provide a description of your filter.

  4. 左側的樹狀檢閱顯示了您在步驟 1 所選取的追蹤記錄的結構。The tree view on the left displays the structure of the trace record you selected in step 1. 請瀏覽至您要建立相關條件的項目。Browse to the element you want to create a condition for. 在此範例中,流覽至要位於 XPath: /E2ETraceEvent/System/Execution/@ThreadID 節點中的 ThreadID。In this example, browse to the ThreadID to be located in the XPath: /E2ETraceEvent/System/Execution/@ThreadID node. 按兩下樹狀檢視中的 [ThreadID] 屬性。Double-click the ThreadID attribute in the tree view. 這樣可在對話方塊右側建立屬性的運算式。This creates an expression for the attribute on the right of the dialog.

  5. 將 [ThreadID] 條件的 [參數] 欄位從 [無] 變更為 [{0}]。Change the parameter field for the ThreadID condition from None to ‘{0}’. 此步驟會在套用篩選器時,讓您設定 [ThreadID] 值This step enables the ThreadID value to be configured when the filter is applied. (請參閱「如何套用篩選器」一節)。您最多可以定義四個參數。(See the How to Apply a Filter section) You can define up to four parameters. 所有條件將由 OR 運算子結合在一起。Conditions are combined using the OR operator.

  6. 按一下 [確定] 以建立篩選準則。Click Ok to create the filter.

注意

使用範本精靈建立篩選器之後,您就只能手動進行編輯。Once a filter has been created using the template wizard, it can only be edited manually. 您無法針對先前已經建立的篩選器啟動精靈。It is not possible to activate the wizard for a filter that has been created previously. 此外,在範本精靈內建立的所有 XPath 篩選條件會透過 OR 運算子結合在一起。In addition, the conditions of an XPath filter created in the template wizard are combined using the OR operator. 如果您需要用到 AND 運算,可以在建立好篩選器之後,編輯篩選器運算式。If you require an AND operation, you can edit the filter expression after it has been created.

手動建立自訂篩選器Creating a Custom Filter Manually

[自訂篩選] 功能表可讓您手動輸入 XPath 篩選條件。The Custom Filters menu allows you to enter XPath filters manually.

  1. 在 [View] 功能表中,按一下 [自訂篩選] 功能表項目。In the View menu, click the Custom Filters menu item.

  2. 在出現的對話方塊中,按一下 [新增]。In the dialog that appears, click New.

  3. 請至少指定一個篩選器名稱與 XPath 運算式。At the minimum, specify a Filter Name and XPath expression.

  4. 按一下 [確定]。Click OK.

套用自訂篩選器Applying a Custom Filter

建立自訂篩選器後,可透過篩選器工具列存取自訂篩選器。Once a custom filter has been created, it is accessible though the filter toolbar. 在 [篩選器] 工具列的 [搜尋于] 欄位中,選取您要套用的篩選準則。Select the filter you want to apply in the Search In field of the filter toolbar. 針對先前的範例選取 [Thread ID]。For the previous example, select ‘Thread ID’.

  1. 在 [尋找目標] 欄位中,指定您要尋找的值。Specify the value you are looking for in the Find What field. 在此範例中,輸入您要搜尋的執行緒 ID。In our example, enter the ID of the thread you want to search for.

  2. 按一下 [立即篩選],並觀察作業的結果。Click Filter Now, and observe the result of the operation.

如果您的篩選器使用多個參數,請在 [尋找目標] 欄位中使用 '; ' 做為分隔符號來輸入它們。If your filter uses multiple parameters, enter them using ‘;’ as a separator in the Find What field. 例如,下列字串定義了 3 個參數:‘1;findValue;text’。For example, the following string defines 3 parameters: ‘1;findValue;text’. 檢視器會將 ' 1 ' 套用至篩選準則的 {0} 參數。The viewer applies ‘1’ to the {0} parameter of the filter. ' findValue ' 和 ' text ' 會分別套用至 {1} 和 {2}。‘findValue’ and ‘text’ are applied to {1} and {2} respectively.

共用自訂篩選器Sharing custom Filters

您可以在不同的工作階段和不同的使用者之間共用自訂篩選器。Custom filters can be shared between different sessions and different users. 您可以將篩選器匯出到定義檔中,然後將此檔案匯入到其他位置。You can export the filters to a definition file and import this file at another location.

若要匯入自訂篩選器:To import a custom filter:

  1. 在 [ View ] 功能表中,按一下 [自訂篩選]。In the View menu, click Custom Filters.

  2. 在開啟的對話方塊中,按一下 [匯] 按鈕。In the dialog box that opens, click the Import button.

  3. 流覽至自訂篩選檔案(. .stvcf),按一下該檔案,然後按一下 [開啟] 按鈕。Navigate to the custom filter file (.stvcf), click the file, and click the Open button.

若要匯出自訂篩選器:To export a custom filter:

  1. 在 [View] 功能表中,按一下 [自訂篩選]。In the View menu, click Custom Filters.

  2. 在隨即開啟的對話方塊內,選取您要匯出的篩選器。In the dialog box that opens, select the filter you want to export.

  3. 按一下 [匯出] 按鈕。Click the Export button.

  4. 指定自訂篩選定義檔案(. .stvcf)的名稱和位置,然後按一下 [儲存] 按鈕。Specify the name and location of the custom filter definition file (.stvcf), and click the Save button.

注意

您只能透過服務追蹤檢視器來匯入與匯出這些自訂的篩選器。These custom filters can only be imported and exported from Service Trace Viewer. 您無法使用其他工具來讀取這些篩選器。They cannot be read by other tools.

尋找資料Finding Data

檢視器提供以下尋找資料的方法:The viewer provides the following ways to find data:

  • [尋找] 工具列可讓您快速存取最常用的尋找選項。The Find toolbar provides a quick access to the most common find options.

  • [尋找] 對話方塊提供您更多尋找選項。The Find dialog provides more find options. 您可以透過 [編輯] 功能表或快速鍵 Ctrl + F 來存取它。It is accessible through the Edit menu, or by the short key Ctrl + F.

尋找工具列會顯示在檢視器上方。The find toolbar appears at the top of the viewer. 如果不存在,您可以在 [ View ] 功能表中啟動它。If it is not present, you can activate it in the View menu. 工具列內含兩個元件:The bar has two components:

  • 尋找目標:讓您輸入搜尋關鍵字。Find What: Allows you to enter search keyword.

  • 查詢:讓您輸入搜尋範圍。Look In: Allows you to enter the search scope. 您可以選擇是否要搜尋所有活動,或是僅限目前的活動。You can select whether to search in all activities or in the current activity only.

[尋找] 對話方塊提供您另外兩個選項:The find dialog provides two additional options:

  • 尋找目標:Find target:

    • [原始記錄資料] 選項會在所有原始資料中搜尋關鍵字。The "Raw log data" option searches the keyword in all raw data.

    • [XML Text] 和 [XML Attribute] 選項只會搜尋 XML 元素。The "XML Text" and "XML Attribute" options only search in XML elements.

    • [已記錄的訊息] 選項只會在訊息中搜尋關鍵字。The "Logged Message" option searches the keyword only in messages.

  • 忽略根活動:搜尋會忽略 "000000000000" 活動中的追蹤。Ignore root activity: The search ignores the traces in the "000000000000" activity. 當根活動擁有數以千計的追蹤項目,而其中大部分為傳輸時,這個選項可以改善在大型追蹤檔案中搜尋的效能。This improves performance in large trace files when the root activity has thousands of traces, most of which are transfers.

由於在應用程式執行階段會逐步記錄追蹤,巡覽追蹤可以幫助您針對應用程式進行偵錯。Because traces are recorded step by step during application runtime, navigating traces can help you to debug your application. 服務追蹤檢視器提供各種巡覽追蹤的方式。The Service Trace Viewer provides various ways to navigate in traces.

逐步前進或逐步返回Step Forward or Backward

如果您將每個追蹤視為程式中的一行程式碼,逐步執行與 Visual Studio 整合式開發環境(IDE)中的「不進入一步」。If you consider each trace as a line of code in the program, stepping forward is very similar to "Step over" in the Visual Studio Integrated Development Environment (IDE). 差別在於,您也可以在追蹤中逐步返回。The difference is that you can also step backward in the traces. 「逐步前進」表示移動至活動內的下一個追蹤。Stepping forward means moving to the next trace in the activity.

  • 逐步執行:使用 [活動] 功能表,或按下 F10。Step Forward: Use the Activity menu, or press "F10". 您也可以在 [追蹤] 窗格中使用方向鍵「向下」。You can also use arrow key "down" in the trace pane.

  • 逐步執行:使用 [活動] 功能表,或按下 F9 鍵。Step Backward: Use the Activity menu, or press "F9". 您也可以在 [追蹤] 窗格中使用方向鍵「向上」。You can also use arrow key "up" in the trace pane.

注意

這會將您帶到在不同進程中或甚至是不同電腦上發生的活動,因為 WCF 訊息可以包含跨越電腦的活動識別碼。This can take you to an activity occurring in a different process or even on a different computer, because WCF messages can carry activity IDs that span machines.

跟隨 TransferFollow Transfer

傳輸追蹤是追蹤檔案中的特別追蹤。Transfer traces are special traces in the trace file. 活動可以藉由傳輸追蹤來傳輸到另一個活動。An activity may transfer to another activity by a transfer trace. 例如,「活動 A」可能會傳送至「活動 B」。For example, "Activity A" may transfer to "Activity B". 在這種情況下,「活動 A」中會有一個名為「To: Activity」和「傳送」圖示的「傳輸」追蹤。In such case, there is a transfer trace in the "Activity A" with the name "To: Activity" and the transfer icon. 這個傳輸追蹤是這兩個追蹤的連結。This transfer trace is a link between the two traces. 在「活動 B」中,活動結尾可能也會有傳輸追蹤,以傳輸回「活動 A」。In "Activity B", there might also be a transfer trace at the end of the activity to transfer back to "Activity A". 這跟程式中的函式呼叫 (Function Call) 類似:A 呼叫 B,然後 B 將資料傳回 A。This is similar to function calls in programs: A calls B, then B returns.

「追蹤轉移」類似偵錯工具中的「逐步執行」。"Follow transfer" is similar to "Step into" in a debugger. 它能跟隨 A 到 B 的傳輸,而且不會對其他追蹤產生任何影響。It follows the transfer from A to B. It does not have any effect on other traces.

您可以透過滑鼠或鍵盤來跟隨傳輸:There are two ways to follow a transfer: by mouse or by keyboard:

  • 透過滑鼠:按兩下追蹤窗格中的傳輸追蹤。By Mouse: Double-click the transfer trace in the trace pane.

  • 透過鍵盤:選取傳輸追蹤,然後使用 [活動] 功能表中的 [跟隨 transfer],或按下 F11 鍵By Keyboard: Select a transfer trace, and use "Follow Transfer" in the Activity menu, or press "F11"

注意

在許多情況下,當活動 A 傳輸至活動 B 時,活動 A 會等候活動 B 傳輸回到活動 A。也就是說,當活動 B 正在進行追蹤的這段期間,活動 A 不會記錄任何追蹤。In many cases, when Activity A transfers to Activity B, Activity A waits until Activity B transfers back to Activity A. This means that Activity A has no trace logged during the period when Activity B is actively tracing. 然而,活動 A 也可能不會等候活動 B 而逕行記錄追蹤。However, it is also possible that Activity A does not wait, and continues to log traces. 活動 B 也可能不會傳輸回到活動 A。因此,這裡的活動傳輸與函式呼叫還是有點不一樣。It is also possible that Activity B does not transfer back to Activity A. Therefore, activity transfers are still different from function calls in this sense. 您可以透過 [圖形] 檢視,更清楚地了解活動傳輸。You can understand activity transfers better in Graph view.

跳到下一個傳輸或跳到上一個傳輸Jump to Next or Previous Transfer

當您在分析目前的活動時,或在已選取多個活動時選取活動,您會希望快速找到它所傳輸到的目標活動。When you are analyzing the current activity, or selected activities when multiple activities are selected, you may want to quickly find the activities it transfers to. 「跳到下一個傳輸」可讓您找出活動中的下一個傳輸追蹤。"Jump to next transfer" allows you to locate the next transfer trace in the activity. 一旦您找到傳輸追蹤,就可以使用「後續傳輸」來逐步執行下一個活動。Once you find the transfer trace, you can use "Follow transfer" to step into the next activity.

  • 跳到下一個傳輸:使用 [活動] 功能表,或按下 Ctrl + F10。Jump to Next Transfer: Use the Activity menu, or press "Ctrl + F10".

  • 跳到上一個傳輸:使用 [活動] 功能表,或按下 Ctrl + F9。Jump to Previous Transfer: Use the Activity menu, or press "Ctrl + F9".

雖然 [活動] 窗格和 [追蹤] 窗格中的導覽類似于調試,但使用 [圖形視圖] 可在導覽中提供更好的體驗。Although navigating in the activity pane and trace pane is similar to debugging, using Graph view provides a much better experience in navigation. 如需詳細資訊,請參閱「圖表視圖」一節。See "Graph View" section for more information.

載入大型追蹤檔Loading Large Trace Files

追蹤檔大小可能非常龐大。Trace files can be very large. 例如,如果您開啟「詳細資訊」層級的追蹤,則執行幾分鐘所產生的追蹤檔案可能很容易就會有數百 mb 或更大的大小,視網路速度和通訊模式而定。For example, if you turn on tracing on the "Verbose" level, the resulting trace file for running a few minutes can easily be hundreds of megabytes or even larger, depending on network speed and communication pattern.

當您在服務追蹤檢視器中開啟一個非常大的追蹤檔時,可能會對系統效能帶來負面影響。When you open a very large trace file in the Service Trace Viewer, system performance can be negatively impacted. 載入速度與載入之後的回應時間可能非常緩慢。The loading speed and the response time after loading can be slow. 實際的速度不一定,取決於您的硬體組態而定。Actual speed differs from time to time, depending on your hardware configuration. 在大部分電腦上,載入大於 200M 的追蹤檔就會對效能有非常大的影響。In most PCs, loading a trace file larger than 200M has a severe performance impact. 如果追蹤檔大小超過 1G,這項工具可能會耗盡所有可用的記憶體,或是停止回應很長一段時間。For traces files larger than 1G, the tool may use up all available memory, or stop responding for a very long time.

為了避免在分析大型追蹤檔案時發生緩慢的載入和回應時間,服務追蹤檢視器會提供一項稱為「部分載入」的功能,一次只會載入追蹤的一小部分。In order to avoid the slow loading and response time in analyzing large trace files, the Service Trace Viewer provides a feature called "Partial Loading", which only loads a small part of the trace at a time. 例如,您的追蹤檔案大小超過 1GB,可以在伺服器上執行好幾天。For example, you may have a trace file over 1GB, running for several days on the server. 當發生一些錯誤而您想要分析追蹤檔案時,不需要開啟整個追蹤檔。When some errors have occurred and you want to analyze the trace, it is not necessary to open the entire trace file. 反之,您可以在錯誤可能發生的特定期間載入追蹤。Instead, you can load the traces within a certain period of time when the error might have occurred. 因為範圍縮小,服務追蹤檢視器工具可以更快地載入檔案,讓您使用較小的資料集來找出錯誤。Because the scope is smaller, the Service Trace Viewer tool can load the file faster and you can identify the errors using a smaller set of data.

啟用部分載入Enabling Partial Loading

您不需要手動啟用部分載入。You do not need to manually enable partial loading. 如果您嘗試載入的追蹤檔案大小總計超過 40MB,服務追蹤檢視器會自動顯示 [部分載入] 對話方塊,讓您選取要載入的部分。If the total size of the trace file(s) you attempt to load exceeds 40MB, Service Trace Viewer automatically displays a Partial Loading dialog for you to select the part that you want to load.

注意

由於追蹤可能不會平均分散在時間範圍內,您在 [部分載入] 工具列中指定的期間長短與顯示的載入大小可能不成比例。Because traces may not be distributed evenly in the time span, the length of the time period you specify in the Partial Loading toolbar may not be proportional to the loading size shown. 實際的載入大小可能比 [部分載入] 對話方塊中的 [預估大小] 還要小。The actual loading size can be smaller than the Estimated Size in the partial loading dialog.

調整部分載入Adjusting Partial Loading

在您部分載入追蹤檔之後,可能會想要變更正在載入的資料集。After you have partially loaded the trace file, you may want to change the data set being loaded. 您可以透過調整檢視器上方的 [部分載入] 工具列來達到這個目的。You can do so by adjusting the Partial Loading toolbar at the top of the viewer.

  1. 使用滑鼠來移動工具列,或是輸入 [開始時間] 與 [結束時間]。Move the toolbar by mouse, or input the Begin and End time.

  2. 按一下 [調整] 按鈕。Click the Adjust button.

了解追蹤圖示Understanding Trace Icons

以下是服務追蹤檢視器工具在 [活動] 視圖、[圖表] 視圖和 [追蹤] 窗格中用來代表不同專案的圖示清單。The following is a list of icons that the Service Trace Viewer tool uses in the Activity view, Graph view and Trace pane to represent different items.

注意

某些未分類的追蹤(例如「訊息已關閉」)沒有圖示。Some traces that are not categorized (for example, "a message is closed") have no icon.

活動追蹤Activity Tracing Traces

圖示Icon 描述Description
警告追蹤Warning trace 警告追蹤:在警告層級發出的追蹤。Warning trace: A trace that is emitted at the warning level
錯誤追蹤Error trace 錯誤追蹤:在錯誤層級發出的追蹤。Error trace: A trace that is emitted at the error level.
活動開始追蹤:Activity Start trace: 活動開始追蹤:標記活動開始的追蹤,Activity Start trace: A trace that marks the beginning of an activity. 其中包含了活動的名稱。It contains the name of the activity. 身為應用程式設計師或開發人員,您應對每個處理序或執行緒的每個活動識別碼定義一個活動「開始」追蹤。As the application designer or developer, you should define one activity Start trace per activity id per process or thread.

如果活動識別碼的傳播因為追蹤相互關聯而跨越追蹤,您會看到同一個活動識別碼有多個「開始」(每個追蹤來源一個)。If the activity id is propagated across trace sources for trace correlation, you can then see multiple Starts for the same activity id (one per trace source). 如果追蹤來源的 ActivityTracing 已啟用,便會發出「開始」追蹤。The Start trace is emitted if ActivityTracing is enabled for the trace source.
活動停止追蹤Activity Stop trace 活動停止追蹤:標記活動停止的追蹤,Activity Stop trace: A trace that marks the end of an activity. 執行個體時提供 SQL Server 登入。. 其中包含了活動的名稱。It contains the name of the activity. 身為應用程式設計師或開發人員,您應對每個追蹤來源的每個活動定義一個活動「停止」追蹤。As the application designer or developer, you should define one activity Stop trace per activity id per trace source. 在指定的追蹤來源發出活動「停止」後,不會出現該追蹤來源的追蹤,除非追蹤時間精細度不夠小。No traces from a given trace source appear after the activity Stop emitted by that trace source, except if the trace time granularity is not sufficiently small. 發生這種情況時,時間相同的兩個追蹤 (包括「停止」) 可能會在顯示時交錯。When that happens, two traces with the same time, including a Stop, may be interleaved when displayed. 如果活動識別碼的傳播因為追蹤相互關聯而跨越追蹤,您會看到同一個活動識別碼有多個「停止」(每個追蹤來源一個)。If the activity id is propagated across trace sources for trace correlation, you can see multiple Stops for the same activity id (one per trace source). 如果追蹤來源的 ActivityTracing 已啟用,便會發出「停止」追蹤。The Stop trace is emitted if ActivityTracing is enabled for the trace source.
活動暫止追蹤Activity Suspend trace 活動暫止追蹤:標記活動暫停時間的追蹤。Activity Suspend trace: A trace that marks the time an activity is paused. 在活動繼續執行之前,暫止活動中不會發出追蹤。No traces are emitted in a suspended activity until the activity resumes. 暫止活動代表追蹤來源範圍內的該活動中沒有發生處理。A suspended activity denotes that no processing is happening in that activity in the scope of the trace source. 暫止/繼續追蹤對於分析很有用。Suspend/Resume traces are useful for profiling. 如果追蹤來源的 ActivityTracing 已啟用,便會發出「暫止」追蹤。The Suspend trace is emitted if ActivityTracing is enabled for the trace source.
活動繼續追蹤Activity resume trace 活動繼續追蹤:標記活動在暫止後恢復繼續之時間的追蹤。Activity resume trace: A trace that marks the time an activity is resumed after it had been suspended. 該活動中會再次發出追蹤。Traces may be emitted again in that activity. 暫止/繼續追蹤對於分析很有用。Suspend/Resume traces are useful for profiling. 如果追蹤來源的 ActivityTracing 已啟用,便會發出「繼續」追蹤。The Resume trace is emitted if ActivityTracing is enabled for the trace source.
傳輸Transfer 傳輸:當邏輯控制流程從一個活動傳輸至另一個活動時發出的追蹤。Transfer: A trace that is emitted when logical control flow is transferred from one activity to another. 傳輸起源的活動會繼續執行工作,與傳輸移至的活動平行。The activity the transfer originates from may continue to perform work in parallel to the activity the transfer goes to. 如果追蹤來源的 ActivityTracing 已啟用,便會發出「傳輸」追蹤。The Transfer trace is emitted if ActivityTracing is enabled for the trace source.
從傳輸Transfer From 傳輸來源:可定義從另一個活動傳輸至目前活動的追蹤。Transfer From: A trace that defines a transfer from another activity to the current activity.
轉移至Transfer To 傳輸目標:可定義從目前活動傳輸至另一個活動之邏輯控制流程的追蹤。Transfer To: A trace that defines a transfer of logical control flow from the current activity to another activity.

WCF 追蹤WCF Traces

圖示Icon 描述Description
訊息記錄追蹤Message Log trace 訊息記錄追蹤:當啟用 System.ServiceModel.MessageLogging 追蹤來源時,由訊息記錄功能記錄 WCF 訊息時,所發出的追蹤。Message Log trace: A trace that is emitted when a WCF message is logged by the message logging feature, when the System.ServiceModel.MessageLogging trace source is enabled. 按一下此追蹤會顯示訊息。Clicking on this trace displays the message. 訊息有四個可設定記錄點:ServiceLevelSendRequest、TransportSend、TransportReceive 和 ServiceLevelReceiveRequest,也可以由訊息記錄追蹤中的 messageSource 屬性來指定。There are four configurable logging points for a message: ServiceLevelSendRequest, TransportSend, TransportReceive, and ServiceLevelReceiveRequest, which can also be specified by the messageSource attribute in the message log trace.
訊息接收的追蹤Message Received trace 已接收訊息追蹤:如果在資訊或詳細資訊層級啟用 System.ServiceModel 追蹤來源,則在收到 WCF 訊息時發出的追蹤。Message Received trace: A trace that is emitted when a WCF message is received, if the System.ServiceModel trace source is enabled at the Information or Verbose level. 此追蹤對於在 [活動圖表] 視圖中查看訊息相互關聯箭號而言是不可或缺的。This trace is essential for viewing the message correlation arrow in the Activity Graph view.
訊息傳送的追蹤Message Sent trace 訊息傳送的追蹤:如果在資訊或詳細資訊層級啟用 System.ServiceModel 追蹤來源時,傳送 WCF 訊息時所發出的追蹤。Message Sent trace: A trace that is emitted when a WCF message is sent if the System.ServiceModel trace source is enabled at the Information or Verbose level. 此追蹤對於在 [活動圖表] 視圖中查看訊息相互關聯箭號而言是不可或缺的。This trace is essential for viewing the message correlation arrow in the Activity Graph view.

活動Activities

圖示Icon 描述Description
活動Activity 活動:表示目前活動為一般活動。Activity: Indicates that the current activity is a generic activity.
根活動Root activity 根活動:表示處理序的根活動。Root activity: Indicates the root activity of a process.

WCF 活動WCF Activities

圖示Icon 描述Description
環境活動Environment activity 環境活動:建立、開啟或關閉 WCF 主機或用戶端的活動。Environment activity: An activity that creates, opens, or closes a WCF host or client. 在這些階段內發生的錯誤會出現在這個活動中。Errors that have happened during these phases will appear in this activity.
接聽活動Listen activity 接聽活動:記錄與接聽項相關之追蹤的活動。Listen activity: An activity that logs traces related to a listener. 在這個活動內,我們可以檢視接聽項資訊和連線要求。Inside this activity, we can view listener information and connection requests.
接收位元組活動Receive Bytes activity 接收位元組活動:這個活動會將所有關於在兩端點間連線上接收傳入位元組的追蹤組成群組。Receive Bytes activity: An activity that groups all traces related to receiving incoming bytes on a connection between two endpoints. 必須有這個活動,才能與傳播活動識別碼的傳輸活動建立相互關聯。This activity is essential in correlating with transport activities that propagate their activity id such as http.sys. 包括連線中止在內的連線錯誤會出現在這個活動中。Connection errors such as aborts will appear in this activity.
處理訊息活動Process Message activity 處理訊息活動:此活動會將與建立 WCF 訊息相關的追蹤組成群組。Process Message activity: An activity that groups traces related to creating a WCF message. 由於信封不良或格式錯誤的訊息而發生的錯誤會出現在這個活動中。Errors due to a bad envelope or a malformed message will appear in that activity. 在這個活動內,我們可以檢查訊息標頭,了解是否已從呼叫端傳播出活動識別碼。Inside this activity, we can inspect message headers to see if an activity id was propagated from the caller. 如果已傳播活動識別碼,當傳輸至處理動作活動 (請參閱下一個圖示) 時,也可以將傳播的活動識別碼指派給該活動,讓呼叫端和被呼叫端追蹤之間能產生相互關聯。If this is true, when we transfer to Process Action activity (the next icon), we can also assign to that activity the propagated activity id for correlation between the caller and callee’s traces.
訊息記錄追蹤Message Log trace 處理動作活動:此活動會將所有與 WCF 要求相關的追蹤,群組在兩個端點。Process Action activity: An activity that groups all traces related to a WCF request across two endpoints. 如果組態中兩個端點上的 propagateActivity 都設為 true,則來自這兩個端點的所有追蹤會合併為一個活動,以便直接相互關聯。If propagateActivity is set to true on both endpoints in configuration, all traces from both endpoints are merged into one activity for direct correlation. 由於傳輸或安全性處理在擴及使用者程式碼界限後返回 (如果回應存在的話) 所造成的錯誤,會包含在這個活動中。Such activity will contain errors due to transport or security processing, extending to the user code boundary and back (if a response exists).
處理訊息活動Process Message activity 執行使用者程式碼活動:將處理要求的使用者程式碼追蹤組成群組的活動。Execute User Code activity: An activity that groups user code traces for processing a request.

疑難排解Troubleshooting

如果您沒有寫入登錄的許可權,當您使用 "svctraceviewer /register" 命令註冊工具時,會收到下列錯誤訊息「Microsoft 服務追蹤檢視器未向系統註冊」。If you do not have permission to write to the registry, you get the following error message "The Microsoft Service Trace Viewer was not registered to the system" when you use the "svctraceviewer /register" command to register the tool. 如果發生這種狀況,您應使用具有登錄寫入權限的帳戶登入。If this occurs, you should log in using an account that has write access to the registry.

此外,服務追蹤檢視器工具會將一些設定 (例如,自訂篩選器和篩選選項) 寫入至其組件資料夾的 SvcTraceViewer.exe.settings 檔中。In addition, the Service Trace Viewer tool writes some settings (for example, custom filters and filter options) to the SvcTraceViewer.exe.settings file in its assembly folder. 如果您沒有此檔案的讀取權限,您仍可以啟動該工具,但無法載入設定。If you do not have read permission for the file, you can still launch the tool, but you cannot load the settings.

如果您在開啟 .etl 檔案時收到錯誤訊息「處理一或多個追蹤時發生未知的錯誤」,則表示 .etl 檔案的格式無效。If you get the error message "An unknown error occurred while processing one or more traces" when opening the .etl file, it means that the format of the .etl file is invalid.

如果您開啟的是使用阿拉伯文作業系統建立的追蹤記錄,可能會發現時間篩選器無法運作。If you open a trace log created using an Arabic operating system, you may notice that the time filter does not work. 例如,2005 年對應到阿拉伯曆的 1427 年。For example, year 2005 corresponds to year 1427 in Arabic calendar. 但是,服務追蹤檢視器工具篩選器所支援的時間範圍並不支援 1752 年之前的日期。However, the time range supported by the Service Trace Viewer tool filter does not support a date earlier than 1752. 這就表示您無法在該篩選器中選取正確的日期。This can imply that you are not able to select a correct date in the filter. 若要解決這個問題,您可以使用 XPath 運算式來建立自訂篩選器(View/自訂篩選)以包含特定的時間範圍。To resolve this problem, you can create a custom filter (View/Custom Filters) using an XPath expression to include a specific time range.

請參閱See also