Debugging Azure Functions Project on Local Machine

Issues when running Azure locally

A common exception seen when encountering this issue is "Error while locating deployment configuration file IronPdf.Native.Chrome.deployment.json"

Recommended: Run Windows-hosted Azure Function Apps that targets .NET Core 3.1 <TargetFramework>netcoreapp3.1</TargetFramework>

Required: Use the default "in-process" configuration when creating an Azure Function in Visual Studio. IronPdf currently does not support Azure Functions running "out-of-process" or in an "isolated process", as described here https://docs.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide#differences-with-net-class-library-functions.

Issue with Dependencies when Running Azure Functions locally

When running Azure locally, using Azurite (VS2022) or the Azure Storage Emulator (VS2019), an additional bin directory is created that the Storage Emulator uses for deployment. Only DLL files are copied to this directory, so software that requires additional files will not function and may throw the above exception.

You may resolve this issue by copying the runtimes directory in to the separate bin directory used by the Storage Emulator. We recommend doing this as a  post-build event (see below for instructions) when running locally (as recompile/build will return the bin directory to its original state). You will not encounter this issue when deploying to the cloud.

  • Problem: When running an Azure Function project locally, it creates an additional bin folder which it runs the function out of. However, it does not copy all of the necessary files into said bin folder.
  • Example: A project at C:\code\azure-functions-test that builds to C:\code\azure-functions-test\bin\Debug\netcoreapp3.1
  • Solution: Copy the C:\code\azure-functions-test\bin\Debug\netcoreapp3.1\runtimes directory so it also exists within C:\code\azure-functions-test\bin\Debug\netcoreapp3.1\bin
  • Overwrite any existing files if prompted

Post-Build Event:

  1. Right-click on the Azure Functions project, select Properties
  2. Scroll down to the Events section
  3. Enter a Post-build event of XCOPY "$(TargetDir)runtimes" "$(TargetDir)bin/runtimes" /S /E /Y /I /R /D