簡體   English   中英

ChakraCore.dll部署到Azure Web App時出現異常

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

我有一個應用程序,它使用Babel將一些動態JS轉換為es5兼容的JS,以便在IE瀏覽器中使用。

此設置在本地完美運行,但一旦部署到Azure,我在嘗試呼叫時不斷收到以下異常

var babel = ReactEnvironment.Current.Babel;

觸發異常:

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)

例外情況表明ChakraCore.dll很可能丟失,或者Visual Studio 2017的C ++ Redistributable。 我假設Azure中存在可再發行組件,因為這個https://feedback.azure.com/forums/355860-azure-functions/suggestions/31130971-install-visual-c-2015-or-2017-redistributale

檢查Azure中的文件時,ChakraCore.dll似乎存在 在此輸入圖像描述

我也試過這里的建議卸載並重新安裝所有相關的軟件包https://github.com/reactjs/React.NET/issues/400

好吧,感謝一些絕望的試驗和錯誤,它只是添加了對JavaScriptEngineSwitcher.ChakraCore.Native軟件包的其他平台的支持,我最初只有win-x64,但安裝了win-x86並對它進行了排序並得到了它在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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM