The following describes profiling of a .NET application running on a remote machine,
i.e. when the application and the profiler UI run on different machines.
Read about profiling local standalone applications here.
Read about profiling ASP.NET on local machine here.
1. Copy the profiler agent DLL to the remote machine
If the application to be profiled runs on a 32-bit .NET Framework
(always the case when your have 32-bit Windows),
you should copy file <Profiler Installation Directory>\bin\win32\ynpagent.dll
If the application to be profiled runs on a 64-bit .NET Framework,
you should copy file <Profiler Installation Directory>\bin\win64\ynpagent.dll
Further we will refer to the file as ynpagent.dll
You can place ynpagent.dll to an arbitrary directory on the remote machine,
given that it will be accessible for the user under which you will run
the profiled application.
2. Register the DLL on the remote machine
On the remote machine, open command prompt (cmd.exe) in the directory where you have placed ynpagent.dll,
and run the following command:
-
On 32-bit Windows:
regsvr32 ynpagent.dll -
On 64-bit Windows, if you use 64-bit .NET framework:
%WINDIR%\system32\regsvr32 ynpagent.dll -
On 64-bit Windows, if you use 32-bit .NET framework:
%WINDIR%\syswow64\regsvr32 ynpagent.dll
If the DLL is successfully registered, you will get corresponding message.
3. Set up a profiling environment
Specify the following two environment variables:
set COR_PROFILER=GUID
set COR_ENABLE_PROFILING=1
GUID is unique for each profiler version (even minor).
Please find its value in <Profiler Installation Directory>\guid.txt
Pay attention that GUID starts with { and ends with }
Please also consider startup options.
You may need to restart Windows. For detail, please refer to the following MSDN article
Special notes on profiling a Windows service can be found here.
4. Run the application
If profiling was properly enabled, the profiled application should start with the profiler agent.
To ensure it has started with the profiler, check whether log file has been created:
<user home directory>\.ynp\log\<PID>.log
5. Connect to the application
On the local machine, start the profiler UI and invoke File | Connect to Remote Application...
First, try to specify the remote machine host only (i.e. without port), as in most cases the port can be detected automatically. If automatic detection does not work or connection fails, please see Remote profiling troubleshooting
