In this exercise, you will learn how to deploy and use IntelliTrace in Production to capture trace information for an ASP.NET application.
- Log in as Adam. All user passwords are P2ssw0rd.
Launch Internet Explorer and click on the FF Customer Portal button in the favorites bar to load the customer portal for Fabrikam Fiber Support (https://www.fabrikam.com).
Fabrikam Fiber customer portal
Select a few of the service tickets from the My Tickets section of the page to view their details until you come across one that indicates that an error occurred retrieving data from the server. This information is ultimately pulled from a database, but there could be any number of reasons for the general error message itself.
Error message shown when selecting service ticket
- Close Internet Explorer.
- Typically, the first step in determining the root cause of an error like this would be to check logs for details and perhaps a stack trace. If that does not provide enough information, and the error is not easily reproduced in a development environment, the development team may end up taking a long time to determine the root cause and fix the problem. Installing Visual Studio or other debugging tools in a production environment may not be an option.
Now let’s look at how to deploy and use IntelliTrace in a production environment to collect historical debugging data. Open a Windows Explorer window and navigate to the root of the C: drive. Note that there are two folders here that were created ahead of time for our use in this lab, c:\IntelliTrace is where the standalone IntelliTrace files are placed and c:\LogFileLocation is where the IntelliTrace files will be written to later on in this lab.
Location of IntelliTrace files folder and log file folder
- In an Explorer window, right-click on the LogFileLocation folder and select Properties to open the Properties window. We need to make sure that the IIS application pool has permission to use the LogFileLocation folder.
Select the Security tab and then scroll down the existing list of groups and user names to find FabrikamFiber.Extranet.Web. Permissions were added ahead of time in this VM, but in a production environment, you would need to make sure to perform this step yourself.
Setting security to enable log files to be written
- Press the Escape key to exit out of the properties window.
IntelliTrace can be deployed to a production environment simply by extracting the contents of the IntelliTraceCollection.cab file that ships with Visual Studio 11. This task has also been performed ahead of time in the VM for your convenience, so there is no need for you to perform this step.
Extracted contents of IntelliTraceCollection.cab file
For the purposes of this lab, the production system is the same as our development system, but that will not normally be the case.
Open a PowerShell window and type the following command to import the IntelliTrace PowerShell module:
To see the commands provided by IntelliTrace, using the following PowerShell command:
Searching for commands that contain “IntelliTrace”
Commands are provided to start and stop an IntelliTrace collection, as well as to take checkpoints during collection.
To get help for any of the PowerShell IntelliTrace commands, type something like the following:
Help screen for the Start-IntelliTraceCollection command
The REMARKS section from the help listing describes how you can get more detailed examples of command usage.
We are now ready to start IntelliTrace collection. Type the following PowerShell command to start collecting data from the FabrikamFiber.Extranet.Web IIS application pool and store the resulting .iTrace log files in the folder we previously created.
Start-IntelliTraceCollection "FabrikamFiber.Extranet.Web" c:\IntelliTrace\collection_plan.ASP.NET.trace.xml c:\LogFileLocation
In the Visual Studio 11, you can hand-edit the collection plan file if you want to make changes. A graphical editor is expected to be provided in a later release.
When asked to confirm, type “Y” and then press the Enter key to continue.
Confirming the request to start a collection
- Launch Internet Explorer and click on the FF Customer Portal button in the favorites bar to load https://www.fabrikam.com.
IntelliTrace is now setup to gather the debugging data specified in the collection plan configuration file. Select the service tickets to reproduce the error that we saw before. As soon as you see the error, close Internet Explorer.
Reproducing the error
Return to the PowerShell window and type the following command to get the current collection status.
Get-IntelliTraceCollectionStatus -ApplicationPool "FabrikamFiber.Extranet.Web"
Type the following command to stop gathering IntelliTrace data for the FabrikamFiber.Extranet.Web application pool. Confirm the action when prompted.
As an alternative to stopping an IntelliTrace collection, it is also possible to get a copy of the current log by using the Checkpoint-IntelliTraceCollection command. This allows you to look at the data you have captured so far while continuing to collect additional data.
- In a real-world scenario, it is at this point that the IntelliTrace file would be sent to a developer or tester for a more detailed look.