Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,23 @@ This topic describes the format of trace data, how to view it, and approaches th
> [!NOTE]
> In WCF, we show response messages being processed initially in a separate activity (Process message) before we correlate them to the corresponding Process Action activity that includes the request message, through a transfer. This happens for infrastructure messages and asynchronous requests and is due to the fact that we must inspect the message, read the activityId header, and identify the existing Process Action activity with that id to correlate to it. For synchronous requests, we are blocking for the response and hence know which Process action the response relates to.

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace4.gif "e2eTrace4")
WCF client activities listed by creation time (left panel) and their nested activities and traces (upper right panel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this sentence to a paragraph before the image like

"The following image shows..."

Otherwise, only screen readers will have this info.

The alt text could say Screenshot of Trace Viewer showing [WCF client activities listed by creation time.

Apply same feedback to the other images here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this change. Will apply to other images here (and other PRs, as needed). On the alt text, if I add the text as you recommend, it ends up higher than the 70 character threshold. I modified to be <70. Please review and let me know if it is OK.

The following image shows WCF client activities listed by creation time (left panel) and their nested activities and traces (upper right panel):

![Screenshot showing WCF client activities listed by creation time.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-client-activities-creation-time.gif)

When we select an activity in the left panel, we can see nested activities and traces on the upper right panel. Therefore, this is a reduced hierarchical view of the list of activities on the left, based on the selected parent activity. Because the selected Process action Add is the first request made, this activity contains the Set Up Secure Session activity (transfer to, transfer back from), and traces for the actual processing of the Add action.

If we double click the Process action Add activity in the left panel, we can see a graphical representation of the client WCF activities related to Add. The first activity on the left is the root activity (0000), which is the default activity. WCF transfers out of the ambient activity. If this is not defined, WCF transfers out of 0000. Here, the second activity, Process Action Add, transfers out of 0. Then we see Setup Secure Session.

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace5.gif "e2eTrace5")
Graph view of WCF client activities: Ambient Activity (here 0), Process action, and Set Up Secure Session

The following image shows a graph view of WCF client activities, specifically Ambient Activity (here 0), Process action, and Set Up Secure Session:

![Graph in the Trace Viewer showing Ambient Activity and Process action.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-activities-graph-ambient-process.gif)

On the upper right panel, we can see all traces related to the Process Action Add activity. Specifically, we have sent the request message ("Sent a message over a channel") and received the response ("Received a message over a channel") in the same activity. This is shown in the following graph. For clarity, the Set up Secure Session activity is collapsed in the graph.

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace6.gif "e2eTrace6")
List of traces for the Process Action activity: we send the request and receive the response in the same activity.
The following image shows a list of traces for the Process Action activity. We send the request and receive the response in the same activity.

![Screenshot of Trace Viewer showing a list of traces for the Process Action activity](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/process-action-traces.gif)

Here, we load client traces only for clarity, but service traces (request message received and response message sent) appear in the same activity if they are also loaded in the tool and `propagateActivity` was set to `true.` This is shown in a later illustration.

Expand All @@ -156,14 +159,17 @@ List of traces for the Process Action activity: we send the request and receive
6. For out-of-process action, we create an "Execute user code" activity to isolate traces emitted in user code from the ones emitted in WCF. In the preceding example, the "Service sends Add response" trace is emitted in the "Execute User code" activity not in the activity propagated by the client, if applicable.

In the illustration that follows, the first activity on the left is the root activity (0000), which is the default activity. The next three activities are to open the ServiceHost. The activity in column 5 is the listener, and the remaining activities (6 to 8) describe the WCF processing of a message, from bytes processing to user code activation.

The following image shows a graph view of WCF service activities:

![Screenshot of Trace Viewer showing a list of WCF service activities](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-service-activities.gif)

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace7.gif "e2eTrace7")
List of WCF service activities

The following screenshot shows the activities for both the client and service, and highlights the Process Action Add activity across processes (orange). Arrows relate the request and response messages sent and received by the client and service. The traces of Process Action are separated across processes in the graph, but shown as part of the same activity in the upper-right panel. In this panel, we can see client traces for sent messages followed by service traces for received and processed messages.

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace8.gif "e2eTrace8")
Graph view of both WCF client and service activities
The following images shows a graph view of both WCF client and service activities

![Graph from Trace Viewer that shows both WCF client and service activities.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-client-service-activities.gif)

In the following error scenario, error and warning traces at the service and client are related. An exception is first thrown in user code on the service (right-most green activity that includes a warning trace for the exception "The service cannot process this request in user code."). When the response is sent to the client, a warning trace is again emitted to denote the fault message (left pink activity). The client then closes its WCF client (yellow activity on the lower-left side), which aborts the connection to the service. The service throws an error (longest pink activity on the right).

Expand All @@ -175,8 +181,9 @@ Error correlation across the service and client
## Troubleshooting Using the Service Trace Viewer
When you load trace files in the Service Trace Viewer Tool, you can select any red or yellow activity on the left panel to track down the cause of a problem in your application. The 000 activity typically has unhandled exceptions that bubble up to the user.

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace10.gif "e2eTrace10")
Selecting red or yellow activity to locate the root of a problem
The following image shows how to select a red or yellow activity to locate the root of a problem.
![Screenshot of red or yellow activities for locating the root of a problem.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/service-trace-viewer.gif)


On the upper right panel, you can examine traces for the activity you selected on the left. You can then examine red or yellow traces in that panel and see how they are correlated. In the preceding graph, we see warning traces both for the client and service in the same Process Action activity.

Expand All @@ -189,8 +196,9 @@ Expanding activities to track the root cause of a problem

If Message Logging is enabled, you can use the Message Tab to see which message is impacted by the error. By double-clicking a message in red or yellow, you can see the graph view of the related activities. These activities are the ones most closely related to the request where an error happened.

![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/e2etrace11.gif "e2eTrace11")
To start troubleshooting, you can also pick a red or yellow message trace and double click it to track the root cause
![Screenshot of Trace Viewer with message logging enabled.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/message-logging-enabled.gif)

To start troubleshooting, you can also pick a red or yellow message trace and double click it to track the root cause.

## See also
- [End-To-End Tracing Scenarios](../../../../../docs/framework/wcf/diagnostics/tracing/end-to-end-tracing-scenarios.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,45 @@ This topic describes how to create a simple workflow service using messaging act

3. When the project is created, the Service1.xamlx file is opened in the designer as shown in the following illustration.

![The default workflow displayed in the designer](../../../../docs/framework/wcf/feature-details/media/defaultworkflowservice.JPG "DefaultWorkflowService")
![Screenshot shows the open Service1.xamlx file in the designer.](./media/how-to-create-a-workflow-service-with-messaging-activities/default-workflow-service.jpg)

Right-click the activity labeled **Sequential Service** and select **Delete**.

### To implement the workflow service

1. Select the **Toolbox** tab on the left side of the screen to display the toolbox and click the pushpin to keep the window open. Expand the **Messaging** section of the toolbox to display the messaging activities and the messaging activity templates as shown in the following illustration.

![The toolbox with messaging tab expanded](../../../../docs/framework/wcf/feature-details/media/wfdesignertoolbox.JPG "WFDesignerToolbox")
![Screenshot that shows the toolbox with Messaging section expanded.](./media/how-to-create-a-workflow-service-with-messaging-activities/toolbox-messaging-section.jpg)

2. Drag and drop a **ReceiveAndSendReply** template to the workflow designer. This creates a <xref:System.Activities.Statements.Sequence> activity with a **Receive** activity followed by a <xref:System.ServiceModel.Activities.SendReply> activity as shown in the following illustration.

![ReceiveAndSendReply template in designer](../../../../docs/framework/wcf/feature-details/media/receiveandsendreply.JPG "ReceiveAndSendReply")
![Screenshot that shows the ReceiveAndSendReply template.](./media/how-to-create-a-workflow-service-with-messaging-activities/receiveandsendreply-template.jpg)

Notice that the <xref:System.ServiceModel.Activities.SendReply> activity’s <xref:System.ServiceModel.Activities.SendReply.Request%2A> property is set to `Receive`, the name of the <xref:System.ServiceModel.Activities.Receive> activity to which the <xref:System.ServiceModel.Activities.SendReply> activity is replying.

3. In the <xref:System.ServiceModel.Activities.Receive> activity type `Echo` into the textbox labeled **OperationName**. This defines the name of the operation the service implements.

![Specify the operation name](../../../../docs/framework/wcf/feature-details/media/defineoperation.JPG "DefineOperation")
![Screenshot that shows where to specify the operation name.](./media/how-to-create-a-workflow-service-with-messaging-activities/define-operation-name.jpg)

4. With the <xref:System.ServiceModel.Activities.Receive> activity selected, open the properties window if not already open by clicking the **View** menu and selecting **Properties Window**. In the **Properties Window** scroll down until you see **CanCreateInstance** and click the checkbox as shown in the following illustration. This setting enables the workflow service host to create a new instance of the service (if needed) when a message is received.

![CanCreateInstance property](../../../../docs/framework/wcf/feature-details/media/cancreateinstance.JPG "CanCreateInstance")
![Screenshot that shows the CanCreateInstance property.](./media/how-to-create-a-workflow-service-with-messaging-activities/cancreateinstance-property.jpg)

5. Select the <xref:System.Activities.Statements.Sequence> activity and click the **Variables** button in the lower left corner of the designer. This displays the variables editor. Click the **Create Variable** link to add a variable to store the string sent to the operation. Name the variable `msg` and set its **Variable** type to String as shown in the following illustration.

![Add a variable](../../../../docs/framework/wcf/feature-details/media/addvariable.JPG "AddVariable")
![Screenshot that shows how to add a variable.](./media/how-to-create-a-workflow-service-with-messaging-activities/add-variable-msg-string.jpg)

Click the **Variables** button again to close the variables editor.

6. Click the **Define..** link in the **Content** text box in the <xref:System.ServiceModel.Activities.Receive> activity to display the **Content Definition** dialog. Select the **Parameters** radio button, click the **Add new Parameter** link, type `inMsg` in the **name** text box, select **String** in the **Type** drop down list box, and type `msg` in the **Assign To** text box as shown in the following illustration.

![Adding Parameters Content](../../../../docs/framework/wcf/feature-details/media/parameterscontent.jpg "ParametersContent")
![Screenshot that shows adding Parameters content.](./media/how-to-create-a-workflow-service-with-messaging-activities/adding-parameters-content.jpg)

This specifies that the Receive activity receives string parameter and that data is bound to the `msg` variable. Click **OK** to close the **Content Definition** dialog.

7. Click the **Define...** link in the **Content** box in the <xref:System.ServiceModel.Activities.SendReply> activity to display the **Content Definition** dialog. Select the **Parameters** radio button, click the **Add new Parameter** link, type `outMsg` in the **name** textbox, select **String** in the **Type** dropdown list box, and `msg` in the **Value** text box as shown in the following illustration.

![Adding Parameters Content](../../../../docs/framework/wcf/feature-details/media/parameterscontent2.jpg "ParametersContent2")
![Screenshot that shows how to add the outMsg parameter.](./media/how-to-create-a-workflow-service-with-messaging-activities/outmsg-parameters-content.jpg)

This specifies that the <xref:System.ServiceModel.Activities.SendReply> activity sends a message or message contract type and that data is bound to the `msg` variable. Because this is a <xref:System.ServiceModel.Activities.SendReply> activity, this means the data in `msg` is used to populate the message the activity sends back to the client. Click **OK** to close the **Content Definition** dialog.

Expand All @@ -69,17 +69,17 @@ This topic describes how to create a simple workflow service using messaging act

2. Select the **Web** tab and select **Specific Page** under **Start Action** and type `Service1.xamlx` in the text box as shown in the following illustration.

![The project properties dialog](../../../../docs/framework/wcf/feature-details/media/projectpropertiesdlg.JPG "ProjectPropertiesDlg")
![Screenshot that shows the project properties dialog.](./media/how-to-create-a-workflow-service-with-messaging-activities/project-properties-dialog.jpg)

This hosts the service defined in Service1.xamlx in the ASP.NET Development Server.

3. Press Ctrl + F5 to launch the service. The ASP.NET Development Server icon is displayed in the lower right side of the desktop as shown in the following image.

![The ASP.NET Developer Server Icon](../../../../docs/framework/wcf/feature-details/media/aspnetdevservericon.JPG "ASPNETDEVServerIcon")
![Screenshot that shows the ASP.NET Developer Server icon.](./media/how-to-create-a-workflow-service-with-messaging-activities/asp-net-dev-server-icon.jpg)

In addition, Internet Explorer displays the WCF Service Help Page for the service.

![WCF Help Page](../../../../docs/framework/wcf/feature-details/media/wcfhelppate.JPG "WCFHelpPate")
![Screenshot that shows the WCF Service Help Page.](./media/how-to-create-a-workflow-service-with-messaging-activities/wcf-service-help-page.jpg)

4. Continue on to the [How To: Access a Service From a Workflow Application](../../../../docs/framework/wcf/feature-details/how-to-access-a-service-from-a-workflow-application.md) topic to create a workflow client that calls this service.

Expand Down