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

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

我们正在制作一个 ASP.NET Core 3.0 应用程序,其中一部分在 React 中实现。出于这个原因,我们 Reactjs.Net 库(最新版本)带有 WebPack 捆绑器和服务器端渲染。 它在我的开发机器上完美运行,但是当部署到 Azure App Service 时我收到错误:

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

我已尝试使用此处的这些教程正确注册 JavaScript 引擎:

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

我们正在使用 Chakra-Core 引擎 JS 引擎,ChackraCore.dll 正在正确部署到 x64 文件夹中的 Azure AppService。

但这没有用。不知道要检查什么。有什么想法吗?

我在 Reactjs.net 库中遇到了类似的问题。问题是默认情况下 Reactjs.net 使用 64 位版本的 Chakra-Core 引擎。确保您的 Azure AppService 是 运行 64 位,以便它可以加载 JavaScript 引擎 dll。您可以从应用程序设置中更改它

azure application settings