ReactJs.NET 并且使用 V8 的服务器端呈现在生产中抛出异常
ReactJs.NET and server side rendering with V8 throws exception in production
我在 ASP.NET MVC 4 项目中使用 ReactJs.NET。我已通过在应用程序启动时调用的 ReactConfig.cs 中指定此选项来禁用对 MSIE javascript 引擎的回退:
ReactSiteConfiguration.Configuration.SetAllowMsieEngine(false);
这适用于我的开发机器,但不适用于生产环境。抛出的异常是:
Failed to initialise ClearScript V8. This is most likely caused by the native libraries (ClearScriptV8-64.dll and v8-x64.dll) missing from your app's Bin directory, or the Visual C++ runtime not being installed
我已确保将 ClearScript.V8 文件夹(带有 ClearScriptV8-64.dll 和 v8-x64.dll)复制到生产服务器和 bin 文件夹,所以我目前正在查看是否缺少 Visual C++ 运行时。我下载并安装了位于此处的 Visual C++ Redistributable for Visual Studio 2015:https://www.microsoft.com/en-us/download/details.aspx?id=48145 但抛出了相同的异常。
我在这里明显遗漏了什么吗?是不是我安装的Visual C++ runtime不对?
那些 DLL 文件是否在 ClearScript.V8 文件夹中?例如,他们需要在 bin\ClearScript.V8\ClearScriptV8-64.dll
。
或者,您可以试用 ReactJS.NET 3.0 的候选版本,它使用更新版本的 JavaScriptEngineSwitcher,它改变了 V8 的加载方式,不再需要手动复制 DLL 文件。目前没有关于 ReactJS.NET 3.0 的文档,但它与当前的 2.x 版本非常相似。我很快就会为最终版本编写文档。
就我而言,我设法通过安装 Visual C++ 2013 运行时解决了这个问题,这是在这种情况下实际工作的唯一版本。我在 2012 年和 2015 年都没有运气。
我在这里找到了答案:
https://github.com/reactjs/React.NET/issues/80
对我有帮助的评论是:
Just another note, ClearScript 5.4.4 readme says VS2015 or 2013 C++
runtimes will work, but in my experience, it only worked when 2013's
was present.
我在 ASP.NET MVC 4 项目中使用 ReactJs.NET。我已通过在应用程序启动时调用的 ReactConfig.cs 中指定此选项来禁用对 MSIE javascript 引擎的回退:
ReactSiteConfiguration.Configuration.SetAllowMsieEngine(false);
这适用于我的开发机器,但不适用于生产环境。抛出的异常是:
Failed to initialise ClearScript V8. This is most likely caused by the native libraries (ClearScriptV8-64.dll and v8-x64.dll) missing from your app's Bin directory, or the Visual C++ runtime not being installed
我已确保将 ClearScript.V8 文件夹(带有 ClearScriptV8-64.dll 和 v8-x64.dll)复制到生产服务器和 bin 文件夹,所以我目前正在查看是否缺少 Visual C++ 运行时。我下载并安装了位于此处的 Visual C++ Redistributable for Visual Studio 2015:https://www.microsoft.com/en-us/download/details.aspx?id=48145 但抛出了相同的异常。
我在这里明显遗漏了什么吗?是不是我安装的Visual C++ runtime不对?
那些 DLL 文件是否在 ClearScript.V8 文件夹中?例如,他们需要在 bin\ClearScript.V8\ClearScriptV8-64.dll
。
或者,您可以试用 ReactJS.NET 3.0 的候选版本,它使用更新版本的 JavaScriptEngineSwitcher,它改变了 V8 的加载方式,不再需要手动复制 DLL 文件。目前没有关于 ReactJS.NET 3.0 的文档,但它与当前的 2.x 版本非常相似。我很快就会为最终版本编写文档。
就我而言,我设法通过安装 Visual C++ 2013 运行时解决了这个问题,这是在这种情况下实际工作的唯一版本。我在 2012 年和 2015 年都没有运气。
我在这里找到了答案:
https://github.com/reactjs/React.NET/issues/80
对我有帮助的评论是:
Just another note, ClearScript 5.4.4 readme says VS2015 or 2013 C++ runtimes will work, but in my experience, it only worked when 2013's was present.