Install - .NET Framework Agent Controller on Containerized IIS App for Dynamic Analysis


Installation Steps

  1. Download the latest vFunction Windows Controller Installation ZIP
  2. Download a sample installation.yaml
  3. Set the Configurable Settings in the downloaded installation.yaml
  4. Create a folder for vFunction artifacts in the Artifact Repository accessible by the Docker Build
  5. Add the vFunction Windows Controller Installation ZIP and the installation.yaml to the Artifact Repository
  6. Create a vFunction specific branch to add the vFunction artificats to the Application’s Dockerfile
  7. Modify the Application’s Dockerfile
Please be aware of the commented out notes that include find-and-replace workflows to modify the workflow below

FROM base_image_like_mcr.microsoft.com/dotnet/framework/aspnet
RUN existing_application_dockerfile_stuff

########### vFunction ###########
# Place Windows Controller Installation Zip and Installation.yaml in vf-install directory on image
COPY vf-install/* /app

# 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:\vfunction -Force

# Place the installation.yaml in the location where it needs to exist
RUN Copy-Item -Path c:\app\installation.yaml -Destination c:\vfunction\config\installation\instances\default-dotnet\installation.yaml

# Set up vFunction's Controller, Viper to run as Processes but don't start those processes at Build Time
RUN powershell -NoProfile -ExecutionPolicy unrestricted -Command "c:\vfunction\controller-installation\install.ps1 -instance default-dotnet -runAsServices false -scriptMode true -noServices true"

# Add Environmental Variables to the IIS App Pool
# If using a different App Pool besides DefaultAppPool, find-and-replace that string

RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='VF_AGENT_CONF_LOCATION';value='c:\vfunction\config\agent\instances\default-dotnet\conf.json'} 
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='COR_PROFILER_PATH_64';value='c:\vfunction\agent\vfagent.net.dll'}  
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='COR_PROFILER_PATH_32';value='c:\vfunction\agent\vfagent.net.x86.dll'}
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='COR_ENABLE_PROFILING';value='1'}  
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='COR_PROFILER';value='{cd7d4b53-96c8-4552-9c11-6e41df8eab8a}'} 
RUN Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/add[@name='DefaultAppPool']/environmentVariables" -name "." -value @{name='COMPlus_TailCallOpt';value='0'}  

# In the Application's start.ps1, add the following line before the actual application starts
# This starts the Controller and Viper process at Runtime as background processes
# powershell -NoProfile -ExecutionPolicy unrestricted -Command "c:\vfunction\controller-installation\restart-controller.ps1 -instance default-dotnet"


ENTRYPOINT ["powershell", "C:\\inetpub\\wwwroot\\start.ps1"]

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