Search code examples
asp.net-coreazure-web-app-servicereactjs.net

Reactjs.net on Azure Error: ReactJS.NET has not been initialised correctly


we are making a ASP.NET Core 3.0 application that has one part implemented in React. For that reason we Reactjs.Net library (the latest version) with WebPack bundler and server-side rendering. It works perfectly on my development machine but when deployed to Azure App Service I get the error:

ReactJS.NET has not been initialised correctly. Please ensure you have called services.AddReact() and app.UseReact() in your Startup.cs file

I have tried properly registering the JavaScript engines by using these tutorials from here:

  1. Publish to azure, asp.net core React app
  2. https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines

We are using the Chakra-Core engine JS engine and the ChackraCore.dll is being properly deployed to the Azure AppService in the x64 folder.

But this doesn't help. Don't know what to check. Any ideas?


Solution

  • I had a similar issue with Reactjs.net library. The issue was that by default Reactjs.net uses the 64-bit version of Chakra-Core engine. Make sure that your Azure AppService is running in 64bit so that it can load the JavaScript engine dll. You can change it from Application Settings

    azure application settings