Clearscript: ASP.NET Core 3.1 w/ClearScript Azure Web App

Created on 9 Feb 2020  路  11Comments  路  Source: microsoft/ClearScript

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.

bug external fixed

All 11 comments

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!

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鈥檛 think this is the issue.

@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>

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)

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)

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!

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.

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.

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!

That's a shame :(

Fixed in Version 6.0.1.

Was this page helpful?
0 / 5 - 0 ratings