Azure App Services Series – Finding #4: Hybrid Connections – Could not load file or assembly Newtonsoft.Json
This blog post is one of many of a series we have about Microsoft Azure App Services. See a list of all our findings here.
Azure BizTalk Services – Hybrid Connections allow you to access on-premise resources, such as SQL instances, files, etc from Azure app services – web, API, mobile and logic apps.
By enabling your app services to use on-premise resources you can together with Integration Manager monitor even more!
Microsoft created and released e.g. a protocol connector enabling you to access on-premise files – the File connector. This connector uses Hybrid Connections to access files located on your on-premise file system.
If you follow tutorials / documentations on how to get started with Hybrid Connections you learn that you have to have a BizTalk Services instance in Azure, this instance can have one or several hybrid connections (see pricing of BizTalk Services to learn more about limitations). While setting up and configuring your hybrid connection, it requires you to install a service/agent on your on-premise machine called the Hybrid Connection Manager. Installing the agent sometimes works and sometimes not.
We came across a file not found error during installation. Newtonsoft.Json file could not be found and therefore the installer throws an exception stating “Could not load file or assembly Newtonsoft.json…”.
Unfortunately there is no post from Microsoft about it, there are some forum posts regarding this error message, but we could not find a proper blog post about how to resolve the problem.
We solved the issue by installing the proper version of the Newtonsoft.Json.dll into the Global Assembly Cache (GAC). The error message of the installer tells you which version you need, which in our case was version 4.5.x.x. We downloaded the dll with version 4.5.11 from the Newtonsoft.json Github project downloads and installed it into the GAC. Installing the DLL into the GAC can be done by using the Developer Command Prompt for Visual Studio and executing the gacutil.exe with the proper parameters.
The command prompt will show a message that the assembly has successfully been added to the GAC (see screenshot 1).
When you are done, restart the installer of the Hybrid Connection Manager and you should be good to go (if there is not another bug hidden somewhere along the installation!).
We hope this helps you solving issues during the installation of the Hybrid Connection Manager!