by Tony Phan, June 2021

Dynamic operations can only be performed in homogenous appdomain

Fix the error "Dynamic operations can only be performed in homogenous appdomain" when trying to call a web service from within NAV.

Description

I created an Add-in that connects to SAP Concur via RESTful web services to automate the management of list items when I ran into this error "Dynamic operations can only be performed in homogenous appdomain".  A google search lead me to https://community.dynamics.com/365/customerservice/f/dynamics-365-for-customer-service-forum/387287/dynamic-operations-can-only-be-performed-in-homogenous-appdomain-c

The solution was to change the setting below from the default of "true" to "false", however, it did not mention which file.
<NetFx40_LegacySecurityPolicy enabled="false" />

A solution provided mentioned the link below, however, it too failed to mention the file.
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element

Eventually, I was able to figure out the file that needed to be modified was "Microsoft.Dynamics.Nav.Server.exe.CONFIG" which is located under "C:\Program Files\Microsoft Dynamics NAV\100\Service\".  Please note that this can be different for you, depending on your version of NAV.

After updating the file, you'll need to restart the service instance in order for it to take effect.