Using the IntelliTrace stand-alone collector (C#, Visual Basic)
Članak
The IntelliTrace stand-alone collector lets you collect IntelliTrace diagnostic data for your apps on production servers or other environments without installing Visual Studio on the target machine and without changing the target system's environment. The IntelliTrace stand-alone collector works on web, SharePoint, WPF and Windows Forms apps. When you're done collecting data, just delete the collector to uninstall it.
Visual Studio Enterprise (but not Professional or Community editions) on a development computer or other computer to open .iTrace files
Bilješka
Make sure to save your symbol (.pdb) files. To debug with IntelliTrace and step through code, you must have the matching source files and symbol files. See Diagnose problems after deployment.
Install IntelliTrace PowerShell cmdlets to collect data for Web apps or SharePoint applications
On your app's server, make sure that PowerShell is enabled. On most versions of Windows Server, you can add this feature in the Server Manager administrative tool.
Install the IntelliTrace PowerShell cmdlets.
Open a PowerShell command window as an administrator.
Choose Start, All Programs, Accessories, Windows PowerShell.
Choose one of the following steps:
On 64-bit operating systems, open the shortcut menu for Windows PowerShell. Choose Run as administrator.
On 32-bit operating systems, open the shortcut menu for Windows PowerShell (x86). Choose Run as administrator.
In the PowerShell command window, use the Import-Module command to import Microsoft.VisualStudio.IntelliTrace.PowerShell.dll.
On your app's server, create the .iTrace file directory, for example: C:\IntelliTraceLogFiles
Bilješka
To avoid slowing down your app, choose a location on a local high-speed disk that's not very active.
You can put .iTrace files and the collector files in the same place. However, if you have a Web app or SharePoint application, make sure this place is outside the directory that hosts the application.
Važno
Restrict the .iTrace file directory only to those identities that must work with the collector. An .iTrace file might contain sensitive information, such as data from users, databases, other source locations, and connection strings because IntelliTrace can record any data that passes into method parameters or as return values.
Make sure those who can open .iTrace files have the authority to view sensitive data. Use caution when sharing .iTrace files. If other people must have access, copy the files to a secure shared location.
For a Web app or SharePoint application, give its application pool full permissions to the .iTrace file directory. You can use the Windows icacls command or use Windows Explorer (or File Explorer).
For example:
To set up permissions with the Windows icacls command:
For a Web app in the DefaultAppPool application pool:
The name of the application pool where your application runs
PathToCollectionPlan
The path to a collection plan, an .xml file that configures settings for the collector.
You can specify a plan that comes with the collector. The following plans work for Web apps and SharePoint applications:
- collection_plan.ASP.NET.default.xml Collects only IntelliTrace events and SharePoint events, including exceptions, database calls, and Web server requests. - collection_plan.ASP.NET.trace.xml Collects function calls and all the data in collection_plan.ASP.NET.default.xml. This plan is good for detailed analysis, but it might slow down your app more than collection_plan.ASP.NET.default.xml.
To avoid slowing down your app, customize these plans or create your own plan. For security, put any custom plans in the same secure location as the collector files. See Creating and Customizing IntelliTrace Collection Plans and How do I get the most data without slowing down my app?Note: By default, the max size of the .iTrace file is 100 MB. When the .iTrace file reaches this limit, the collector deletes the file's earliest entries to make space for newer entries. To change this limit, edit the collection plan's MaximumLogFileSize attribute.
Where can I find localized versions of these collection plans?
You can find localized plans in the collector's subfolders.
FullPathToITraceFileDirectory
The full path to the .iTrace file directory. Security Note: Provide the full path, not a relative path.
The collector attaches to the application pool and starts collecting data.
Can I open the .iTrace file at this time? No, the file is locked during data collection.
Reproduce the problem.
To create a checkpoint of the .iTrace file, use this syntax:
After you run this command, type Y to confirm that you want to stop collecting data. Otherwise, the collector might continue collecting data, the iTrace file will remain locked, or the file might not contain any useful data.
The full path to the collector executable, IntelliTraceSC.exe
PathToCollectionPlan
The path to a collection plan, an .xml file that configures settings for the collector.
You can specify a plan that comes with the collector. The following plans work for managed apps:
- collection_plan.ASP.NET.default.xml Collects IntelliTrace events only, including exceptions, database calls, and Web server requests. - collection_plan.ASP.NET.trace.xml Collects function calls and all the data in collection_plan.ASP.NET.default.xml. This plan is good for detailed analysis, but it might slow down your app more than collection_plan.ASP.NET.default.xml.
To avoid slowing down your app, customize these plans or create your own plan. For security, put any custom plans in the same secure location as the collector files. See Creating and Customizing IntelliTrace Collection Plans and How do I get the most data without slowing down my app?Note: By default, the max size of the .iTrace file is 100 MB. When the .iTrace file reaches this limit, the collector deletes the file's earliest entries to make space for newer entries. To change this limit, edit the collection plan's MaximumLogFileSize attribute.
Where can I find localized versions of these collection plans?
You can find localized plans in the collector's subfolders.
FullPathToITraceFileDirectoryAndFileName
The full path to the .iTrace file directory and the .iTrace file name with the .itrace extension. Security Note: Provide the full path, not a relative path.
To debug with IntelliTrace and step through code, you must have the matching source files and symbol files. See Diagnose problems after deployment.
Move the .iTrace file or copy it to a computer with Visual Studio Enterprise (but not Professional or Community editions).
Double-click the .iTrace file outside Visual Studio, or open the file from inside Visual Studio.
Visual Studio shows the IntelliTrace Summary page. In most sections, you can review events or other items, choose an item, and start debugging with IntelliTrace at the point where and when an event happened. See Using saved IntelliTrace data.
Bilješka
To debug with IntelliTrace and step through code, you must have the matching source files and symbol files on your development machine. See Diagnose problems after deployment.
How do I get the most data without slowing down my app?
For Web apps and SharePoint applications, the collector records data for every app that shares the specified application pool. This might slow down any app that shares the same application pool, even though you can only specify modules for a single app in a collection plan.
To prevent the collector from slowing down other apps, host each app in its own application pool.
Review the events in the collection plan for which IntelliTrace collects data. Edit the collection plan to disable events that aren't relevant or don't interest you.
To disable an event, set the enabled attribute for the <DiagnosticEventSpecification> element to false:
<DiagnosticEventSpecification enabled="false">
If the enabled attribute doesn't exist, the event is enabled.
How does this improve performance?
You can reduce startup time by disabling events that aren't relevant to the app. For example, disable Windows Workflow events for apps that don't use Windows Workflow.
You can improve both startup and run-time performance by disabling registry events for apps that access the registry but don't show problems with registry settings.
Review the modules in the collection plan for which IntelliTrace collects data. Edit the collection plan to include only the modules that interest you:
Open the collection plan. Find the <ModuleList> element.
In <ModuleList>, set the isExclusionList attribute to false.
Use the <Name> element to specify each module with one of the following: file name, string value to include any module whose name contains that string, or public key.
For example, to collect data from just the main Web module of the Fabrikam Fiber Web app, create a list like this one:
This reduces the amount of method call information and other instrumentation data that IntelliTrace collects when the app starts and runs. This data lets you:
Step through code after collecting the data.
Examine values passed to and returned from function calls.
Why not exclude modules instead?
By default, collection plans exclude modules by setting the isExclusionList attribute to true. However, excluding modules might still result in collecting data from modules that don't meet the list's criteria and might not interest you, such as third-party or open-source modules.
Is there any data that IntelliTrace doesn't collect?
Yes, to reduce performance impact, IntelliTrace restricts data collection to values of primitive data types passed to and returned from methods and to values of primitive data types in fields on top-level objects passed to and returned from methods.
For example, suppose you have an AlterEmployee method signature that accepts an integer id and an Employee object oldemployee:
public Employee AlterEmployee(int id, Employee oldemployee)
The Employee type has the following attributes: Id, Name, and HomeAddress. An association relationship exists between Employee and the Address type.
The collector records values for id, Employee.Id, Employee.Name and the Employee object returned from the AlterEmployee method. However, the collector doesn't record information about the Address object other than whether it was null or not. The collector also doesn't record data about local variables in the AlterEmployee method unless other methods use those local variables as parameters at which point they are recorded as method parameters.
Where else can I get IntelliTrace data?
You can get IntelliTrace data from an IntelliTrace debugging session in Visual Studio Enterprise. See IntelliTrace Features.
Explore new features in Visual Studio 2019, including instant code cleanup, collaboration through a Git-first workflow, and automatic snapshots of app execution.