Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASP.NET Core 3.1 w/ClearScript Azure Web App #166

Closed
upsilondynamics opened this issue Feb 9, 2020 · 11 comments
Closed

ASP.NET Core 3.1 w/ClearScript Azure Web App #166

upsilondynamics opened this issue Feb 9, 2020 · 11 comments

Comments

@upsilondynamics
Copy link

Having issues when I deploy my .NET Core 3.1 app to Azure (ASP.NET CORE).

Runs locally without issue, what causes this? All the projects are set to build as x64 if that makes ay difference. Files that exist in the site/wwwroot:

D:\home\site\wwwroot>ls ClearScript*.dll
ClearScript.dll
ClearScriptV8-32.dll
ClearScriptV8-64.dll

D:\home\site\wwwroot>ls v8*.dll
v8-base-ia32.dll
v8-base-x64.dll
v8-ia32.dll
v8-libcpp-ia32.dll
v8-libcpp-x64.dll
v8-x64.dll

Works locally without issue, why is it not working when deployed as an Azure Web App?

      2/9/2020 3:58:13 AM	Method GenerateFlow: System.TypeLoadException: Cannot load V8 interface assembly. Load failure information for ClearScriptV8-64.dll:
D:\home\site\wwwroot\ClearScriptV8-64.dll: An attempt was made to load a program with an incorrect format. (0x8007000B)
    ClearScriptV8-64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35: Could not load file or assembly 'ClearScriptV8-64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

@ClearScriptLib
Copy link
Collaborator

Hi @upsilondynamics,

What is your web application's host operating system? ClearScript requires Windows, but at the moment Azure appears to support .NET Core 3.1 only on Linux (see here).

Thanks!

@upsilondynamics
Copy link
Author

Running Windows on the app resource. If you look closely at the links you sent they had it globally launched Dec 13th I believe. And the second link in the answer states others are able to confirm 3.1LTS working on windows containers.

So if clearscript requires windows I don’t think this is the issue.

@upsilondynamics
Copy link
Author

@ClearScriptLib Is there a way to add something like this, I remember having to add this for .NET Framework 4.7:

I also remember I had to move the assemblies out from the root of the directory to bin\ClearScript.V8:

Also, why is it working locally, but not on Azure?

      <assemblies>
        <remove assembly="ClearScriptV8-64" />
        <remove assembly="ClearScriptV8-32" />
      </assemblies>

@upsilondynamics
Copy link
Author

upsilondynamics commented Feb 9, 2020

Full stack trace when I try and move the files out of the root (x64)

      2/9/2020 6:36:28 PM	Method GenerateFlow: System.TypeLoadException: Cannot load V8 interface assembly. Load failure information for ClearScriptV8-64.dll:
D:\home\site\wwwroot\ClearScriptV8-64.dll: Could not load file or assembly 'D:\home\site\wwwroot\ClearScriptV8-64.dll'. The system cannot find the file specified.
ClearScriptV8-64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35: Could not load file or assembly 'ClearScriptV8-64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

         at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()

         at Microsoft.ClearScript.V8.V8Proxy.LoadAssemblyWithIJWHostLibrary()

         at Microsoft.ClearScript.V8.V8Proxy.GetAssembly()

         at Microsoft.ClearScript.V8.V8Proxy.GetImplType(Type type)

         at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)

         at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags)

         at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name)

@upsilondynamics
Copy link
Author

And.. when I leave it in, why is it saying it's an incorrect format when it's clearly marked x64?


      2/9/2020 6:39:36 PM	Method GenerateFlow: System.TypeLoadException: Cannot load V8 interface assembly. Load failure information for ClearScriptV8-64.dll:
D:\home\site\wwwroot\ClearScriptV8-64.dll: An attempt was made to load a program with an incorrect format. (0x8007000B)
ClearScriptV8-64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35: Could not load file or assembly 'ClearScriptV8-64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

         at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()

         at Microsoft.ClearScript.V8.V8Proxy.LoadAssemblyWithIJWHostLibrary()

         at Microsoft.ClearScript.V8.V8Proxy.GetAssembly()

         at Microsoft.ClearScript.V8.V8Proxy.GetImplType(Type type)

         at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)

         at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags)

         at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name, V8RuntimeConstraints constraints)

         at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(String name)

@ClearScriptLib
Copy link
Collaborator

ClearScriptLib commented Feb 9, 2020

Hi @upsilondynamics,

Thanks for reporting this issue. We've identified the cause.

Despite the unfortunate error message, the problem is a missing 64-bit Visual C++ component named VCRUNTIME140_1.DLL. It was added in a recent update but apparently has yet to make its way to Azure's ASP.NET host configuration. You can read about the component and its related compiler feature here.

We'll disable this feature in our next release, temporarily eliminating ClearScript's dependence on VCRUNTIME140_1.DLL. We'll then re-enable it when Azure's ASP.NET PaaS has been updated.

In the meantime you have several options:

  1. Run your application in 32-bit mode.
  2. Deploy VCRUNTIME140_1.DLL with your application. You should be able to find it in %WINDIR%\System32 on a 64-bit development machine.
  3. Build ClearScript yourself, disabling the compiler feature that introduces the dependency.
  4. Try contacting Azure Support about updating your host.

Please let us know if any of these options work for you, and thanks again for reporting this!

@upsilondynamics
Copy link
Author

Let me start by saying YOU GUYS ROCK. Your proposed solution worked, for the time being I will simply package that DLL into my build pipeline and should be good.. Thanks for working so hard on getting a solution this quickly.

@erik-kallen
Copy link

Would there be any major disadvantage to link to the VC runtime statically instead of depending on the DLL? We are using ClearScript extensively, and it does cause hard-to-debug issues sometimes that the correct version of the redistributable needs to be installed.

@ClearScriptLib
Copy link
Collaborator

Hi @erik-kallen,

Unfortunately static linking can't be combined with CLR support for C++:

cl : command line error D8016: '/clr' and '/MT' command-line options are incompatible

Sorry!

@erik-kallen
Copy link

That's a shame :(

ClearScriptLib added a commit that referenced this issue Apr 13, 2020
…Hub Issue #160); fixed 64-bit V8 initialization on Azure App Service (GitHub Issue #166); enabled DirectAccess for ComVisible .NET objects (GitHub Issue #161); added ScriptEngine.ExposeHostObjectStaticMembers (GitHub Issue #152); added ScriptEngine.UndefinedImportValue and made Undefined.Value public (GitHub Issue #154); enhanced ExtendedHostFunctions.typeLibEnums to pull in external enumerations; added thread affinity enforcement in WindowsScriptEngine.Dispose; eliminated KeyNotFoundException when checking for system documents (GitHub Issue #169); enabled the use of the application's root folder as a backup for its local data folder (GitHub Issue #171); reduced minimum CPU profile and heap size sampling intervals to 125 ms; updated deployment and API documentation, resolving GitHub Issues #158 and #159. Tested with V8 8.1.307.28.
@ClearScriptLib
Copy link
Collaborator

Fixed in Version 6.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants