简体   繁体   English

ChakraCore.dll部署到Azure Web App时出现异常

[英]ChakraCore.dll Exception when deployed to Azure Web App

I have an app which uses the Babel to transpile some dynamic JS into es5 compatible JS for use in IE browsers. 我有一个应用程序,它使用Babel将一些动态JS转换为es5兼容的JS,以便在IE浏览器中使用。

This setup works perfectly locally however once deployed to Azure I keep getting the following exception when trying to call 此设置在本地完美运行,但一旦部署到Azure,我在尝试呼叫时不断收到以下异常

var babel = ReactEnvironment.Current.Babel;

Exception triggered: 触发异常:

React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.ReactEnvironment (Error getting vue module script) ---> React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.JavaScriptEngineFactory ---> JavaScriptEngineSwitcher.Core.JsEngineLoadException: Failed to create instance of the ChakraCoreJsEngine. Most likely it happened, because the 'ChakraCore.dll' assembly or one of its dependencies was not found. Try to install the JavaScriptEngineSwitcher.ChakraCore.Native.win-x86 package via NuGet. In addition, you still need to install the Microsoft Visual C++ Redistributable for Visual Studio 2017 (https://www.visualstudio.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2017). ---> System.DllNotFoundException: Unable to load DLL 'ChakraCore' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at React.TinyIoC.TinyIoCContainer.ConstructType(System.Type, System.Type, System.Reflection.ConstructorInfo, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
at React.TinyIoC.TinyIoCContainer+CustomObjectLifetimeFactory.GetObject(System.Type, React.TinyIoC.TinyIoCContainer, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
at React.TinyIoC.TinyIoCContainer.ResolveInternal(React.TinyIoC.TinyIoCContainer+TypeRegistration, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
at React.TinyIoC.TinyIoCContainer.Resolve(System.Type)
at React.TinyIoC.TinyIoCContainer.Resolve()
at App.Controllers.ComponentController+<ModuleRegistrationIE11>d__4.MoveNext()
--- End of inner exception stack trace ---
at React.TinyIoC.TinyIoCContainer.ConstructType(System.Type, System.Type, System.Reflection.ConstructorInfo, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
at React.TinyIoC.TinyIoCContainer+SingletonFactory.GetObject(System.Type, React.TinyIoC.TinyIoCContainer, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
at React.TinyIoC.TinyIoCContainer.ResolveInternal(React.TinyIoC.TinyIoCContainer+TypeRegistration, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
at React.TinyIoC.TinyIoCContainer.ConstructType(System.Type, System.Type, System.Reflection.ConstructorInfo, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
--- End of inner exception stack trace ---
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine..ctor(JavaScriptEngineSwitcher.ChakraCore.ChakraCoreSettings)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngineFactory.CreateEngine()
at JSPool.JsPool`2.CreateEngine()
at JSPool.JsPool`2.PopulateEngines()
at JSPool.JsPool`2..ctor()
at React.JavaScriptEngineFactory.CreatePool()
at React.JavaScriptEngineFactory..ctor(JavaScriptEngineSwitcher.Core.IJsEngineSwitcher, React.IReactSiteConfiguration, React.ICache, React.IFileSystem)
at lambda_method(System.Runtime.CompilerServices.Closure, System.Object[])
at React.TinyIoC.TinyIoCContainer.ConstructType(System.Type, System.Type, System.Reflection.ConstructorInfo, React.TinyIoC.NamedParameterOverloads, React.TinyIoC.ResolveOptions)
--- End of inner exception stack trace ---
at JavaScriptEngineSwitcher.ChakraCore.JsRt.NativeMethods.JsCreateRuntime(JavaScriptEngineSwitcher.ChakraCore.JsRt.JsRuntimeAttributes, JavaScriptEngineSwitcher.ChakraCore.JsRt.JsThreadServiceCallback, JavaScriptEngineSwitcher.ChakraCore.JsRt.JsRuntime&)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine+<>c__DisplayClass10_1.<.ctor>b__0()
at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher+<>c__DisplayClass11_0.<Invoke>b__0()
at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.StartThread()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.InnnerInvoke(System.Func`1[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]])
at JavaScriptEngineSwitcher.ChakraCore.ScriptDispatcher.Invoke(System.Action)
at JavaScriptEngineSwitcher.ChakraCore.ChakraCoreJsEngine..ctor(JavaScriptEngineSwitcher.ChakraCore.ChakraCoreSettings)

The exception suggests that the ChakraCore.dll is most likely missing or the C++ Redistributable for Visual Studio 2017 is. 例外情况表明ChakraCore.dll很可能丢失,或者Visual Studio 2017的C ++ Redistributable。 I assume the redistributable is present in Azure becasue of this https://feedback.azure.com/forums/355860-azure-functions/suggestions/31130971-install-visual-c-2015-or-2017-redistributale ? 我假设Azure中存在可再发行组件,因为这个https://feedback.azure.com/forums/355860-azure-functions/suggestions/31130971-install-visual-c-2015-or-2017-redistributale

The ChakraCore.dll appears to be present when inspecting the files in Azure 检查Azure中的文件时,ChakraCore.dll似乎存在 在此输入图像描述

I've also tried the suggestions here uninstalling and reinsatalling all of the relevant packages https://github.com/reactjs/React.NET/issues/400 我也试过这里的建议卸载并重新安装所有相关的软件包https://github.com/reactjs/React.NET/issues/400

Ok so thanks to some desperate trial and error it was simply a case of adding support for other platforms regarding the JavaScriptEngineSwitcher.ChakraCore.Native package, I originally had just the win-x64 but installing the win-x86 as well sorted it and got it working in Azure. 好吧,感谢一些绝望的试验和错误,它只是添加了对JavaScriptEngineSwitcher.ChakraCore.Native软件包的其他平台的支持,我最初只有win-x64,但安装了win-x86并对它进行了排序并得到了它在Azure工作。

This was the end result for the packages I had installed to get my app successfully working in Azure: 这是我为使我的应用程序在Azure中成功运行而安装的软件包的最终结果:

<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore" Version="3.1.1" />
<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore.Native.win-x64" Version="3.1.1" />
<PackageReference Include="JavaScriptEngineSwitcher.ChakraCore.Native.win-x86" Version="3.1.1" />
<PackageReference Include="JavaScriptEngineSwitcher.Core" Version="3.1.0" />
<PackageReference Include="JavaScriptEngineSwitcher.Extensions.MsDependencyInjection" Version="3.1.0" />
<PackageReference Include="JSPool" Version="4.0.0" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 部署在Azure Web App / Azure API上时缺少CORS标头 - CORS headers missing when deployed on Azure Web App / Azure API 部署后,应用无法找到非托管dll - App fails to find unmanaged dll when deployed Web 部署在 Azure 上的应用程序未返回 UTC 日期时间 - Web App deployed on Azure not returning datetimes in UTC 当应用程序部署为 Azure Web 应用程序时,OnTokenValidated 事件未触发,但在本地运行时触发 - OnTokenValidated event not firing when application is deployed as Azure Web App, but fires when running locally Web api在本地工作,但在部署到Azure时则不能 - Web api working locally but not when deployed to Azure 在Azure App服务上托管Web API时发生无效异常 - Invalid Exception when host web api on azure app service Azure 函数应用程序:部署时 TimerTrigger 不触发 - Azure Function App: TimerTrigger not Firing when Deployed Azure应用程序可在开发架构上运行,但在部署时无法运行 - Azure app works on dev fabric but not when deployed Azure function 应用程序在从部署的 web 应用程序调用时未触发 - Azure function app is not triggering while calling from deployed web app 新部署的 Azure Web 应用程序返回 404 错误代码 - New deployed Azure web app is returning 404 Error code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM