Install - .NET 3 / 6 / 7 / 8 Dynamic Agent on Containerized Windows using a Windows Service


Installation Steps

  1. Download the latest vFunction Windows Controller Installation ZIP
  2. Create a folder for vFunction artifacts in the Artifact Repository accessible by the Docker Build
  3. Add the vFunction Windows Controller Installation ZIP to the Artifact Repository
  4. Create a vFunction specific branch to add the vFunction artificats to the Application’s Dockerfile
  5. Modify the Application’s Dockerfile following the Comments to modify values. Note that this is not meant to be a runnable Dockerfile, but is meant to illustrate how vFunction should be added to the existing Dockerfile
FROM base_image_like_mcr.microsoft.com/dotnet/framework/aspnet
RUN existing_application_dockerfile_stuff

########### vFunction ###########
# Place Windows Controller Installation Zip in vf-install directory on image
COPY vf-install/vfunction-controller-windows-installation*.zip /app/vfunction-controller-windows-installation.zip

# Unzip the Controller Installation ZIP
# This Dockerfile uses c:\vfunction as the location from which vFunction runs, find-and-replace this string if desired to run from a different location
RUN Expand-Archive -Path C:\app\vfunction-controller-windows-installation.zip -DestinationPath C:\ -Force

# Add Environment Variables for the VF Installation
# See description in https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/dotnet/windows/#controller_name
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_NAME="CHANGE_ME"
# See description in https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/dotnet/windows/#controller_host
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_HOST="CHANGE_ME"
# See description in https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/dotnet/windows/#controller_org_id
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_ORG_ID="CHANGE_ME"
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_APP_ID="CHANGE_ME"
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_ID="CHANGE_ME"
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_CLIENT_SECRET="CHANGE_ME"
# See description in https://kb.vfunction.com/installations/configurable-settings/mono-dynamic-agent/dotnet/windows/#instance_id
ARG VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_INSTANCE_ID="CHANGE_ME"

# Set up vFunction Agent's Configuration Files
RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command "c:\vfunction\controller-installation\install.ps1 -instance default-dotnet -scriptMode true -noServices true"

# Add Environmental Variables to the Windows Service Registry Key
RUN $vf_values=@("VF_AGENT_CONF_LOCATION=C:\vfunction\config\agent\instances\default-dotnet\conf.json", "CORECLR_PROFILER_PATH_64=C:\vfunction\agent\vfagent.net.dll", "CORECLR_PROFILER_PATH_32=C:\vfunction\agent\vfagent.net.x86.dll", "CORECLR_ENABLE_PROFILING=1 CORECLR_PROFILER={cd7d4b53-96c8-4552-9c11-6e41df8eab8a}", "DOTNET_TailCallOpt=0")

# Find-and-replace SERVICE_NAME with the actual name of the Service
RUN New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\SERVICE_NAME" -Name "Environment" -Value $vf_values -PropertyType MultiString  

ENTRYPOINT ["existing_application_startup_flow"]
  1. Build and deploy the Application
  2. Confirm that the Application comes up and functions as expected
  3. If any issues arise: