Install - .NET Framework Windows Dynamic Agent started as a Windows Service


.NET Framework Compatibility

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


Installation Workflow

  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. Extract the vFunction Installation Package
  6. Gather the Agent UUIDs
  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. Install the vFunction Agent using either Environment Variables or Yamls to set configurable settings:

Use Environment Variables to set Installation Parameters
  1. Open PowerShell
  2. Add Environment Variables for the vFunction Dynamic Agent and install the Agent
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force

if (!(Get-Module -Name WebAdministration -ErrorAction SilentlyContinue)) {
    Import-Module WebAdministration
}

### Modify the path to the location where the vFunction Installation ZIP was unpacked
$BASE_DIR = "C:\bin\vfunction"

### Change the names of the Windows Services that will need the VF Agent
### These names should match the Registry Names for these Services
$Service_Targets = @(
    "WindowsService1", 
    "WindowsService2", 
    "WindowsServer3"

### Paste the App UUIDs from Step #6 above 
$HostUrl      = "http://172.0.0.1"
$OrgID        = "xxxxxx"
$AppID        = "xxxxxx"
$ClientID     = "xxxxxx"
$ClientSecret = "xxxxxx"

Write-Host "Setting permissions and unblocking files..." -ForegroundColor Gray
icacls "$BASE_DIR\" /grant Everyone:F /T | Out-Null
Get-ChildItem -Path "$BASE_DIR" -Recurse | Unblock-File

foreach ($svc in $Service_Targets) {
    if (Get-Service -Name $svc -ErrorAction SilentlyContinue) {
        Write-Host "Found Service: $svc. Configuring vFunction..." -ForegroundColor Cyan
        
        $UpperName = $svc.ToUpper().Replace(".", "_").Replace("-", "_")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_NAME", $svc, "Machine")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_HOST", $HostUrl, "Machine")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_ORG_ID", $OrgID, "Machine")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_APP_ID", $AppID, "Machine")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_CLIENT_ID", $ClientID, "Machine")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_CLIENT_SECRET", $ClientSecret, "Machine")
        [System.Environment]::SetEnvironmentVariable("VF_CONTROLLER_${UpperName}_CONTROLLER_INSTANCE_ID", $svc, "Machine")

        & "$BASE_DIR\controller-installation\create-instance.ps1" -instance $svc -agentMode true -type dotnet
        & "$BASE_DIR\controller-installation\install.ps1" -instance $svc -scriptMode true

        $regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\$svc"
        $envValues = @(
            "VF_AGENT_CONF_LOCATION=$BASE_DIR\config\agent\instances\$svc\conf.json",
            "COR_PROFILER_PATH_64=$BASE_DIR\agent\vfagent.net.dll",
            "COR_PROFILER_PATH_32=$BASE_DIR\agent\vfagent.net.x86.dll",
            "COR_ENABLE_PROFILING=1",
            "COR_PROFILER={cd7d4b53-96c8-4552-9c11-6e41df8eab8a}",
            "COMPlus_TailCallOpt=0"
        )
        Set-ItemProperty -Path $regPath -Name "Environment" -Value $envValues -Type MultiString
        
        Write-Host "Restarting service $svc..." -ForegroundColor Gray
        Restart-Service -Name $svc -Force
    } else {
        Write-Host "Skipping: Windows Service '$svc' not found on this server." -ForegroundColor Yellow
    }
}

Use a YAML to set Installation Parameters
  1. Open PowerShell
  2. Create vFunction Instances for each Windows Service that requires the vFunction Agent
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force

if (!(Get-Module -Name WebAdministration -ErrorAction SilentlyContinue)) {
    Import-Module WebAdministration
}

### Modify the path to the location where the vFunction Installation ZIP was unpacked
$BASE_DIR = "C:\bin\vfunction"

### Change the names of the Windows Services that will need the VF Agent
### These names should match the Registry Names for these Services
$Service_Targets = @(
    "WindowsService1", 
    "WindowsService2", 
    "WindowsServer3"

### Paste the App UUIDs from Step #6 above 
$HostUrl      = "http://172.0.0.1"
$OrgID        = "xxxxxx"
$AppID        = "xxxxxx"
$ClientID     = "xxxxxx"
$ClientSecret = "xxxxxx"

Write-Host "Setting permissions and unblocking files..." -ForegroundColor Gray
icacls "$BASE_DIR\" /grant Everyone:F /T | Out-Null
Get-ChildItem -Path "$BASE_DIR" -Recurse | Unblock-File

foreach ($svc in $Service_Targets) {
    if (Get-Service -Name $svc -ErrorAction SilentlyContinue) {
        Write-Host "Found Service: $svc. Configuring vFunction..." -ForegroundColor Cyan

        & "$BASE_DIR\controller-installation\create-instance.ps1" -instance $svc -agentMode true -type dotnet
    } else {
        Write-Host "Skipping: Windows Service '$svc' not found on this server." -ForegroundColor Yellow
    }
}
  1. In a text editor, open the $BASE_DIR\vfunction\config\installation\instances\$svc\installation.yaml
  2. Paste the values from Step #6 above

controller:
  name: #VF Server UI identifier for the Agent, e.g. QA-Win1-BillPay
  host: #Address of the VF Server, e.g. https://vfunction.organization.com
  org_id: #UUID retrieved from VF Server UI's Install Instructions dialog box
  app_id: #UUID retrieved from VF Server UI's Install Instructions dialog box
  client_id: #UUID retrieved from VF Server UI's Install Instructions dialog box
  client_secret: #UUID retrieved from VF Server UI's Install Instructions dialog box
  type: dotnet
  instance_id: #Field added manually, should match the "name"
  instrconf_additions:
    inclusions:
    exclusions:
  tags:
    - #Strings used for logical groupings for App's Learning, e.g. "prod" or "BillPay"

server_application:

agent:
  version: framework #This field needs to be changed from the default "dotnet"
  environment: service #This field needs to be changed from the default "iis"
  1. Open Powershell
  2. Install the vFunction Agent
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force

if (!(Get-Module -Name WebAdministration -ErrorAction SilentlyContinue)) {
    Import-Module WebAdministration
}

$BASE_DIR = "C:\bin\vfunction"

### Change the names of the Windows Services that will need the VF Agent
### These names should match the Registry Names for these Services
$Service_Targets = @(
    "WindowsService1", 
    "WindowsService2", 
    "WindowsServer3"

Write-Host "Setting permissions and unblocking files..." -ForegroundColor Gray
icacls "$BASE_DIR\" /grant Everyone:F /T | Out-Null
Get-ChildItem -Path "$BASE_DIR" -Recurse | Unblock-File

foreach ($svc in $Service_Targets) {
    if (Get-Service -Name $svc -ErrorAction SilentlyContinue) {
        Write-Host "Found Service: $svc. Configuring vFunction..." -ForegroundColor Cyan

        & "$BASE_DIR\controller-installation\install.ps1" -instance $svc -scriptMode true

        $regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\$svc"
        $envValues = @(
            "VF_AGENT_CONF_LOCATION=$BASE_DIR\config\agent\instances\$svc\conf.json",
            "COR_PROFILER_PATH_64=$BASE_DIR\agent\vfagent.net.dll",
            "COR_PROFILER_PATH_32=$BASE_DIR\agent\vfagent.net.x86.dll",
            "COR_ENABLE_PROFILING=1",
            "COR_PROFILER={cd7d4b53-96c8-4552-9c11-6e41df8eab8a}",
            "COMPlus_TailCallOpt=0"
        )
        Set-ItemProperty -Path $regPath -Name "Environment" -Value $envValues -Type MultiString
        
        Write-Host "Restarting service $svc..." -ForegroundColor Gray
        Restart-Service -Name $svc -Force
    } else {
        Write-Host "Skipping: Windows Service '$svc' not found on this server." -ForegroundColor Yellow
    }
}

  1. Confirm that the Application comes up and functions as expected. If any issues arise:
  1. Start Learning in the vFunction UI
  2. Validate the vFunction data collection