1

我正在 asp.net 核心上制作一个 React 应用程序。我使用 ReactJS.NET 库和 webpack 作为 jsx 组件的捆绑器和转译器。

我让它在本地工作,但是当我部署到天蓝色时,我得到了这个日志:

An unhandled exception occurred while processing the request.

ReactEngineNotFoundException: No usable JavaScript engine was found. Please 
install a JavaScript engine such as React.JavaScriptEngine.ClearScriptV8 (on 
Windows) or React.JavaScriptEngine.VroomJs (on Linux and Mac OS X). Refer to 
the ReactJS.NET documentation for more details.
 React.AspNet.HtmlHelperExtensions.get_Environment()

TinyIoCResolutionException: Unable to resolve type: 
React.JavaScriptEngineFactory
 React.AspNet.HtmlHelperExtensions.get_Environment()

TinyIoCResolutionException: Unable to resolve type: React.ReactEnvironment
 React.AspNet.HtmlHelperExtensions.get_Environment()

ReactNotInitialisedException: ReactJS.NET has not been initialised correctly. 
Please ensure you have called app.AddReact() and app.UseReact() in your 
Startup.cs file.
 React.AspNet.HtmlHelperExtensions.get_Environment()

来自 ReactJS.NET Docs,“从 2.2 版开始,ReactJS.NET 使用 V8 JavaScript 引擎在 Azure 中开箱即用”。它说“.SetAllowMsieEngine(false); on app.UseReact()”,但现在已弃用...

不知道该怎么做:/提前谢谢

4

1 回答 1

1

经过大量尝试,我得到了它的工作。找到了一个 github 帖子https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines

在核心部分安装包,并将代码添加到部署到天蓝色后它工作的startup.cs。V8 包和侏罗纪不适用于 Core。

于 2017-05-26T09:47:57.647 回答