Install - .NET Framework Runtime Agent on a Windows Host started as an IIS Site



.NET Framework Compatibility

vFunction supports C# .NET Framework version 4.x applications.


Application Pool Prerequisites

The vFunction Agent requires a distinct Application Pool to be created for the Application if the current Application Pool is used by multiple Applications. Follow these steps to create a new Application Pool if needed.


Run the Installation Script

  1. Ensure Prerequisites are met
  2. Download the vFunction Windows Controller Installation ZIP
  3. RDP to the Windows Server as the user who runs the Application
  4. Move the Installation ZIP to the location on the Windows Server where vFunction should run
  5. Unzip the vFunction Installation Package to, for example, C:\vfunction
### Change DOWNLOADS_FOLDER to be relevant to your environment
### Change BASE_DIR to the desired location such as C:\vfunction
powershell -NoProfile -ExecutionPolicy unrestricted -Command "Expand-Archive -Path DOWNLOADS_FOLDER\vfunction-controller-windows-installation*.zip -DestinationPath BASE_DIR -Force"
  1. Add the configuration settings for the vFunction Monolithic Agent either as Option A: Manually Created User Environment Variables, as Option B: an installation.yaml or Option C: PowerShell Created User Environment Variables

Option A: Manually Created User Environment Variables

Take the following steps to add configuration settings via User Environment Variables:

  1. Log into the vFunction Server’s UI in a browser
  2. In the top-left corner, click the dropdown and select the relevant Application
  3. In the top-center menu bar, click the “Learning” tab
  4. On the left-side, click the “Select Controllers” link
  5. On the left-side, click the “Install Controller” link
  6. In the dialog box, find the YAML-formatted text box that contains the following details. You’ll need these details at a later stage below:
controller:
  name: {display name for this controller}
  host: http://vfunction.mycompany.com
  org_id: 93af7f38-0000-0000-0000-bd9516798497
  app_id: 9fb228fc-0000-0000-0000-db8e83427e14
  client_id: caeadcd1-0000-0000-0000-9c9b37a9e119
  client_secret: 68cb85eb-0000-0000-0000-fb9e7f1d9240
  1. On the machine where the Application runs, open the Windows Start Menu and search for, “environment variables”
  2. Select the search results to edit the environment variables
  3. On the “System Properties” dialog box, make sure the “Advanced” tab is selected
  4. Select the “Environment Variables” button at the bottom of this page
  5. In the Environment Variables dialog box, find the top section for “User variables”
  6. Click the “New…” button and create the following Variables and Values

Note that the Variable Names below are accurate but the Values are not. Use the values for your environment retrieved from Step #6 above

Variable
Value
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_NAME Create your own display name for this controller such as QA-Windows-1
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_HOST http://demo.vfunction.com
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_ORG_ID 93af7f38-0000-0000-0000-bd9516798497
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_APP_ID 9fb228fc-0000-0000-0000-db8e83427e14
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_ID caeadcd1-0000-0000-0000-9c9b37a9e119
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_SECRET 68cb85eb-0000-0000-0000-fb9e7f1d9240
VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_INSTANCE_ID Create your own display name for this controller such as QA-Windows-1

Option B: An Installation.yaml

Take the following steps to add configuration settings via an installation.yaml:

  1. Log into the vFunction Server’s UI in a browser
  2. In the top-left corner, click the dropdown and select the relevant Application
  3. In the top-center menu bar, click the “Learning” tab
  4. On the left-side, click the “Select Controllers” link
  5. On the left-side, click the “Install Controller” link
  6. In the dialog box, find the YAML-formatted text box that contains the following details. You’ll need these details at a later stage below:
controller:
  name: {display name for this controller}
  host: http://vfunction.mycompany.com
  org_id: 93af7f38-0000-0000-0000-bd9516798497
  app_id: 9fb228fc-0000-0000-0000-db8e83427e14
  client_id: caeadcd1-0000-0000-0000-9c9b37a9e119
  client_secret: 68cb85eb-0000-0000-0000-fb9e7f1d9240
  1. On the machine where the Application runs, open the installation.yaml at the location relevant to where you unpacked the vFunction Controller Installation ZIP, such as C:\vfunction\config\installation\instances\default-dotnet\installation.yaml
### BEFORE
controller:
  name:
  host:
  org_id:
  app_id:
  client_id:
  client_secret:
  type: dotnet
  instrconf_additions:
    inclusions:
#      - a.b.c.
    exclusions:
#      - a.b.c.
  tags:
#    - tag1


### AFTER COPYING FROM STEP #6 ABOVE
controller:
  name: Create your own display name for this controller such as QA-Windows-1
  host: http://demo.vfunction.com
  org_id: 93af7f38-0000-0000-0000-bd9516798497
  app_id: 9fb228fc-0000-0000-0000-db8e83427e14
  client_id: caeadcd1-0000-0000-0000-9c9b37a9e119
  client_secret: 68cb85eb-0000-0000-0000-fb9e7f1d9240
  type: dotnet
  instrconf_additions:
    inclusions:
#      - a.b.c.
    exclusions:
#      - a.b.c.
  tags:
#    - tag1

Option C: PowerShell Created User Environment Variables

Take the following steps to add configuration settings via PowerShell:

  1. Log into the vFunction Server’s UI in a browser
  2. In the top-left corner, click the dropdown and select the relevant Application
  3. In the top-center menu bar, click the “Learning” tab
  4. On the left-side, click the “Select Controllers” link
  5. On the left-side, click the “Install Controller” link
  6. In the dialog box, find the YAML-formatted text box that contains the following details. You’ll need these details at a later stage below:
controller:
  name: {display name for this controller}
  host: $your_VF_Server_address
  org_id: 93af7f38-0000-0000-0000-bd9516798497
  app_id: 9fb228fc-0000-0000-0000-db8e83427e14
  client_id: caeadcd1-0000-0000-0000-9c9b37a9e119
  client_secret: 68cb85eb-0000-0000-0000-fb9e7f1d9240
  1. On the machine where the Application runs, open PowerShell
# The Keys below have Values that are going to be environmentally-specific
# Review and modify this list
[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_NAME', 'Create your own display name for this controller such as QA-Windows-1', 'Machine')

[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_HOST', 'https://vfunction.mycompany.com', 'Machine')

[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_ORG_ID', '93af7f38-0000-0000-0000-bd9516798497', 'Machine')

[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_APP_ID', '9fb228fc-0000-0000-0000-db8e83427e14', 'Machine')

[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_ID', 'caeadcd1-0000-0000-0000-9c9b37a9e119', 'Machine')

[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_SECRET', '68cb85eb-0000-0000-0000-fb9e7f1d9240', 'Machine')

[System.Environment]::SetEnvironmentVariable('VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_INSTANCE_ID', 'Create your own display name for this controller such as QA-Windows-1', 'Machine')

  1. After following Option A, Option B or Option C to add the configuration settings for the vFunction Dynamic Agent, run the vFunction Installation Script
### Replace $BASE_DIR with the Windows location where the vFunction Installation ZIP was unzipped
dir -Path "$BASE_DIR" -Recurse | Unblock-File

powershell -NoProfile -ExecutionPolicy unrestricted -Command "$BASE_DIR\controller-installation\install.ps1 -instance default-dotnet"

Hook the Application with the vFunction Agent

To hook the Application with the vFunction Agent, either choose Option A: edit the applicationHost.config to manually add Environment Variables to the Application Pool or Option B: add Environment Variables to the Application Pool using PowerShell.


Option A: Edit the ApplicationHost.config to manually add Environment Variables to the Application Pool

Take the following steps to edit the ApplicationHost.config for the Application Pool that the IIS Sites uses:

  1. In a text editor, open C:\Windows\System32\inetsrv\config\applicationHost.config
  2. Search for the term applicationPools. Below this, find the relevant Application Pool and add the environmentVariables:
# Replace "BASE_DIR" with the location where the vFunction Installation ZIP was extracted
# Replace "default-dotnet" with the instance name if not using the default instance

<add name="$instance" autoStart="true">
    <environmentVariables>
            <add name="VF_AGENT_CONF_LOCATION" value="BASE_DIR\agent\instances\default-dotnet\conf.json" />
            <add name="COR_PROFILER_PATH_64" value="BASE_DIR\agent\vfagent.net.dll" />
            <add name="COR_PROFILER_PATH_32" value="BASE_DIR\agent\vfagent.net.x86.dll" />
            <add name="COR_ENABLE_PROFILING" value="1" />
            <add name="COR_PROFILER" value="{cd7d4b53-96c8-4552-9c11-6e41df8eab8a}" />
            <add name="COMPlus_TailCallOpt" value="0"/>
    </environmentVariables>
</add>
  1. Save and close the file
  2. In PowerShell, restart the Application Pool for the IIS Site to be profiled
# Replace $instance with the name of the IIS Site's Application Pool
Restart-WebAppPool -Name "$instance"
  1. Confirm that the .NET Application runs as expected
  2. Start Learning in the vFunction Server UI and confirm tracing information is captured as expected

Option B: Use Powershell for the Application Pool

Take the following steps to use PowerShell to set the Application Pool’s Environment Variables:

  1. In PowerShell, add Environment Variables to hook the vFunction Agent into the Application Pool for the IIS Site to be profiled:
# Replace "$instance" with the name of the IIS Site's Application Pool
# Replace "BASE_DIR" with the location where the vFunction ZIP was unzipped
# Replace "default-dotnet" if using a non-default vFunction instance name

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/add[@name='$instance']/environmentVariables" -name "." -value @{name='VF_AGENT_CONF_LOCATION';value='BASE_DIR\agent\instances\default-dotnet\conf.json'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/add[@name='$instance']/environmentVariables" -name "." -value @{name='COR_PROFILER_PATH_64';value='BASE_DIR\agent\vfagent.net.dll'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/add[@name='$instance']/environmentVariables" -name "." -value @{name='COR_PROFILER_PATH_32';value='BASE_DIR\agent\vfagent.net.x86.dll'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/add[@name='$instance']/environmentVariables" -name "." -value @{name='COR_ENABLE_PROFILING';value='1'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/add[@name='$instance']/environmentVariables" -name "." -value @{name='COR_PROFILER';value='{cd7d4b53-96c8-4552-9c11-6e41df8eab8a}'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/add[@name='$instance']/environmentVariables" -name "." -value @{name='COMPlus_TailCallOpt';value='0'}
  1. In PowerShell, restart the Application Pool for the IIS Site to be profiled
# Replace $instance with the name of the IIS Site's Application Pool
Restart-WebAppPool -Name "$instance"
  1. Confirm that the .NET Application runs as expected
  2. Start Learning in the vFunction Server UI and confirm tracing information is captured as expected