Installing and Configuring the .NET Profiler on Azure

To install the .NET profiler on Azure, follow the steps below:

  1. Login to the Azure portal.

  2. Figure 1 then appears. From the options listed at the top of Figure 1, select App Services, as indicated.

    Figure 1 : The Azure console

  3. Figure 2 will then appear listing the web applications deployed on the App Services platform. To deploy the .NET profiler, first locate the .NET application in the list of applications in Figure 2, and then click on it.

    Figure 2 : Click on the .NET application deployed on the App Services platform

  4. Figure 3 will then appear. Keep scrolling down the options listed in the left pane of Figure 3, until you find the Extensions option. Alternatively, you can type Extensions in the Search text box on the top of the left pane. Doing so, will automatically take you to the Extensions option. Once this option becomes visible, click on it.

    Figure 3 : Selecting the Extensions option

  5. Upon selecting the Extensions option from the left pane, the right panel will change to display the list of Extensions that pre-exist (if any). To add a new extension, click on the Add button in the right panel (see Figure 4).

    Figure 4 : Clicking on the Add button in the Extensions page

  6. This will invoke Figure 5. From the Choose Extension drop-down list in Figure 5, select the eG extension, eGEnterprise.dotNET.Azure.

    Figure 5 : Selecting the eG extension

  7. Then, click on the Accept legal terms option in the Legal Terms drop-down. Figure 6 will then appear. Click the OK button in Figure 6 to accept the legal terms.

    Figure 6 : Accepting the legal terms

  8. Figure 7 will then appear indicating that the Legal Terms have been Accepted. Click the OK button in Figure 7 to complete the extension creation.

    Figure 7 : Completing the Extension Creation

  9. Figure 8 will then appear displaying the eG extension that you created newly.

    Figure 8 : The newly created eG extension displayed in the Extensions page

  10. Next, go to the SCM web site of the .NET web application. For that, use the URL: https://<Name_of_web_application> For instance, if the .NET web application to be monitored is egdemoapp, then the SCM URL of the app will be:

  11. Figure 9 will then appear.

    Figure 9 : The SCM web site of the target .NET web application

  12. From the Debug console menu of Figure 9, select the Powershell option (see Figure 10).

    Figure 10 : Selecting the Powershell option from the Debug console menu

  13. Figure 11 will then appear. In Figure 11, follow the folder sequence: site/eG_dotNETBTM. Figure 12 will then appear, displaying the contents of the eG_dotNETBTM folder. Now, proceed to edit the eg_DotnetServer.ini file by clicking on the Edit icon (Pencil icon) corresponding to that file in Figure 11.

    Figure 11 : Viewing the folders

    Figure 12 : Viewing the contents of the eG_dotNETBTM folder

  14. Figure 13 will then appear displaying the contents of the eg_DotnetServer.ini file. Against the Agent_IP parameter that you will see in this file, specify the IP address of the eG remote agent the profiler should communicate with. Then, save the changes by clicking the Save button in Figure 13.

    Figure 13 : Editing the Agent_IP field value

  15. You will then return to Figure 12. Now, copy the eGHelperAssembly.dll file in the \site\eG_dotNETBTM folder to the \site\wwwroot\bin folder. For this, at the Powershell command prompt in Figure 12, issue the following command:


    Copy-Item -Path <Application_Install_Dir>\site\eG_dotNETBTM\eGHelperAssembly.dll -Destination <Application_Install_Dir>\site\wwwroot\bin


    For instance, if the target .NET application is installed in the D:\home folder, then the command to copy will be:


    Copy-Item -Path D:\home\site\eG_dotNETBTM\eGHelperAssembly.dll -Destination D:\home\site\wwwroot\bin


  16. Once the file is successfully copied, click on the Process Explorer option in the main menu of the Kudu console. Figure 14 will appear. Right-click on the w3wp.exe process displayed at the top of Figure 14 and select the Kill option from the shortcut menu that appears to kill that process.

    Figure 14 : Killing the w3wp.exe process

  17. Once the process is killed, send a request to the target .NET application.

How to Check if the eG .NET Profiler has been Successfully Deployed?

To check if the profiler has been successfully deployed, do the following:

  1. In the Process Explorer page of Figure 14, right-click on the w3wp.exe process and select the Properties option from the menu that pops out. Then, click on the Environment Variables tab page. This will invoke Figure 15.

    Figure 15 : The Environment Variables tab page

  2. In Figure 15, check if the COR_ENABLE_PROFILING variable is set to the value 1. Also, check if a GUID is displayed against COR_PROFILER. Also, see if the COR_PROFILER_PATH_32 and COR_PROFILER_PATH_64 variables display the path to the eGCLRMonitor.dll. If all the above are true, then you can conclude that the eG .NET Profiler has been installed successfully.

How Does the eG .NET Profiler Work?

Typically, transaction requests to .NET applications are handled by worker processes. Upon receipt of a request, the worker process automatically invokes an instance of the .NET CLR to process the request. At the same time, the worker process also loads an instance of the .NET profiler. Once the profiler latches on to a worker process, it injects a .NET code into the .NET application code. The injected code adds a GUID to each unique transaction to the application, and performs the following tasks:

  • Traces the path of a transaction;
  • Measures the responsiveness of a transaction by computing the time difference between when the transaction started and when it ended;
  • Identifies the slow, stalled, and error transactions, and computes the count of such transactions;
  • Discovers the exit calls made by a transaction, determines the destination of the calls, and measures the average time taken by each call to process the requests for a transaction;

The profiler then sends all these statistics to the eG agent. To know how and when the profiler transmits metrics to the eG agent, refer to How Does the .NET Profiler Communicate with the eG Agent?