指定 Javascript engineReactJS .NET 使用
Specify which Javascript engineReactJS .NET uses
所以,我知道可以为服务器端渲染指定一个特定的 javascript 引擎。我似乎找不到任何关于它的信息。这是他们的 Github 问题之一的简介,确认这是可能的:
Have you tried running it with the V8 engine instead? The MS one can be flakey (we had similar issues with it but much early on in our dev cycle). The fact it works on 3 other enviros means there has to be a difference between those and the 4th one. Could be its got a different version IE on the production server for instance? Tricky one to track down hence switching to V8 might be a quicker option.
https://github.com/reactjs/React.NET/issues/188
有人知道怎么做吗?我看到不同机器之间存在不一致,我认为(比如 90%)原因是使用了不同的 JS 引擎。我想将其锁定,以便仅使用 v8,以便保持一致。
您需要在 ReactJS.NET 配置上调用 .SetAllowMsieEngine(false)
。对于 ASP.NET 4,默认情况下在 App_Start\ReactConfig.cs
中。对于 ASP.NET Core,它在 Startup.cs
.
中的 UseReact
调用中
这将强制它使用 V8,或者如果无法加载 V8(而不是回退到 MSIE)则抛出异常。最常见的问题是 bin
中缺少 ClearScript.V8
目录。这应该会自动复制到 ASP.NET 4 个站点,但对于 ASP.NET 核心,您需要手动修改构建才能执行此操作(参见 http://reactjs.net/2016/08/protected-memory-exceptions-and-dotnet-core.html)
所以,我知道可以为服务器端渲染指定一个特定的 javascript 引擎。我似乎找不到任何关于它的信息。这是他们的 Github 问题之一的简介,确认这是可能的:
Have you tried running it with the V8 engine instead? The MS one can be flakey (we had similar issues with it but much early on in our dev cycle). The fact it works on 3 other enviros means there has to be a difference between those and the 4th one. Could be its got a different version IE on the production server for instance? Tricky one to track down hence switching to V8 might be a quicker option.
https://github.com/reactjs/React.NET/issues/188
有人知道怎么做吗?我看到不同机器之间存在不一致,我认为(比如 90%)原因是使用了不同的 JS 引擎。我想将其锁定,以便仅使用 v8,以便保持一致。
您需要在 ReactJS.NET 配置上调用 .SetAllowMsieEngine(false)
。对于 ASP.NET 4,默认情况下在 App_Start\ReactConfig.cs
中。对于 ASP.NET Core,它在 Startup.cs
.
UseReact
调用中
这将强制它使用 V8,或者如果无法加载 V8(而不是回退到 MSIE)则抛出异常。最常见的问题是 bin
中缺少 ClearScript.V8
目录。这应该会自动复制到 ASP.NET 4 个站点,但对于 ASP.NET 核心,您需要手动修改构建才能执行此操作(参见 http://reactjs.net/2016/08/protected-memory-exceptions-and-dotnet-core.html)