This project has moved. For the latest updates, please go here.

Azure Mobile Services Cannot Load V8 Interface Assembly

Feb 27, 2015 at 12:47 AM
Getting the following exception when running my Azure Mobile Service:
 Exception=System.TypeLoadException: Cannot load V8 interface assembly. Load failure         information for v8-ia32.dll:
 C:\DWASFiles\Sites\mobile$Service\Temporary ASP.NET      Files\root\1aa0fcb8\40098f63\assembly\dl3\c1d3aac4\014f7f98_0b52d001\v8-ia32.dll: The      specified module could not be found
 MobileServicesDotNet\1.0.450\v8-ia32.dll: The specified module could not be found
 MobileServicesDotNet\1.0.450\bin\v8-ia32.dll: The specified module could not be found
However, the dll is in included in the project root with options set to Content and do not copy local as I used the Clearscript Installer NuGet. Is this a case of not having the VC++ redistributables installed on the server? Is there anyway I can include the necessary redistributables so they are on the server when I deploy?
Coordinator
Feb 27, 2015 at 1:32 PM
Hello AEONSoft,

At first glance this doesn't look like a case of missing VC++ libraries; "The specified module could not be found" indicates that v8-ia32.dll itself is missing.

Can you connect to the Azure instance remotely? If so, you should be able to examine the deployment folder and determine whether v8-ia32.dll is installed, and where. If you can do this, please post your findings.

Thanks!
Feb 27, 2015 at 5:11 PM
v8-ia32.dll is installed in:

d:\home\site\wwwroot
Feb 27, 2015 at 7:00 PM
Edited Feb 27, 2015 at 7:06 PM
Ok, so even though I used the NuGet Clearscript Installer package, it did not put the following in my root project directory:
  ClearScriptV8-32.dll
  ClearScriptV8-64.dll
I've got v8update.cmd building and will try again to deploy my service.
Feb 27, 2015 at 7:12 PM
Ok, so after deploying and see all 4 dlls in d:\home\site\wwwroot, I'm still getting the same exception up top.
Feb 27, 2015 at 7:32 PM
Also, the files are not in where it seems to be looking for them:

D:\Program Files (x86)\SiteExtensions\MobileServicesDotNet\1.0.450\v8-ia32.dll: The specified module could not be found
D:\Program Files (x86)\SiteExtensions\MobileServicesDotNet\1.0.450\bin\v8-ia32.dll: The specified module could not be found
Coordinator
Feb 27, 2015 at 7:34 PM
Hmm, we can't help with NuGet issues, but so far it's unclear why the site root isn't one of the directories being searched for the V8 assemblies.
Feb 27, 2015 at 8:57 PM
Does the Clearscript.dll look for them one level up? If so, it should work. Is there anything I could try changing in the Clearscript project, recompiling, and then redploy my Azure service?
Coordinator
Feb 28, 2015 at 4:58 PM
Hi again,

Does the Clearscript.dll look for them one level up? If so, it should work.

ClearScript searches for the V8 assemblies as follows:
  • In the directory that contains ClearScript.dll. This is expected to fail in ASP.NET deployments due to shadow copying.
  • In AppDomain.CurrentDomain.BaseDirectory. This should be your deployment root directory, but if the exception message above is correct, it isn't being searched at all. Can you confirm that? Is the exception message exactly as shown above? If possible, try catching the exception in code to see its exact message.
  • In the directories in AppDomain.CurrentDomain.RelativeSearchPath. It looks like there might be a ClearScript bug here (it doesn't combine these paths with the deployment root path), but that shouldn't affect your scenario. Again, please verify the correctness and completeness of the exception message.
Is there anything I could try changing in the Clearscript project, recompiling, and then redploy my Azure service?

There's no need to rebuild ClearScript. You can override the V8 assembly loading procedure by using an assembly resolution hook:
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
    if (args.Name == "ClearScriptV8") {
        return Assembly.LoadFrom(@"C:\Custom\Path\To\ClearScriptV8-32.dll");
    }
    return null;
};
Run this code once, at some point before you create your first V8ScriptEngine instance. It should work as long as ClearScriptV8-32.dll and v8-ia32.dll are in the same directory.

Good luck!
Mar 1, 2015 at 2:53 AM
Here's the full exception:

Exception=System.TypeLoadException: Cannot load V8 interface assembly. Load failure information for v8-ia32.dll:
C:\DWASFiles\Sites\mobile$Service\Temporary ASP.NET Files\root\1aa0fcb8\40098f63\assembly\dl3\c1d3aac4\a232f205_bb52d001\v8-ia32.dll: The specified module could not be found
D:\Program Files (x86)\SiteExtensions\MobileServicesDotNet\1.0.450\v8-ia32.dll: The specified module could not be found
D:\Program Files (x86)\SiteExtensions\MobileServicesDotNet\1.0.450\bin\v8-ia32.dll: The specified module could not be found
at Microsoft.ClearScript.V8.V8Proxy.LoadNativeLibrary()
at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()
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, Boolean enableDebugging, Int32 debugPort)
at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)
at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)
Mar 1, 2015 at 3:14 AM
I was able to get it working using your assembly resolve code. Thanks!
Coordinator
Mar 2, 2015 at 1:02 PM
Hi AEONSoft,

Glad to hear that you got it working!

If you get a chance, we'd still very much like to know what AppDomain.CurrentDomain.BaseDirectory and AppDomain.CurrentDomain.RelativeSearchPath return in your deployment scenario.

Thanks!
Mar 23, 2015 at 12:32 PM
Got same problem on IIS 8.5.
  1. It is working on local IIS 7.5 (Windows 7)
  2. Before I put AssemblyResolve code I got an Exception from "at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()" and for ClearScriptV8, that sound like LoadNativeLibrary code was executed succesfully.
  3. After adding AssemblyResolve, I now got an Exception from "at Microsoft.ClearScript.V8.V8Proxy.LoadNativeLibrary()" with
Cannot load V8 interface assembly. Load failure information for v8-x64.dll: C:\Websites\beta.lawfirm.org.ua\bin\v8-x64.dll: The specified module could not be found C:\Websites\beta.lawfirm.org.ua\v8-x64.dll: The specified module could not be found
I am using this code for AssemblyResolving
var rootPath = HostingEnvironment.MapPath("/Dependencies");
if (args.Name.Contains("ClearScript"))
{
     return Assembly.LoadFrom(Path.Combine(rootPath, "ClearScriptV8-64.dll"));
}
As you see all libs are in Dependencies folder. While v8 is not requested to AssemblyResolver, ClearScriptV8. If I put v8 into root folder, error is the same.

AppDomain.CurrentDomain.BaseDirectory -> "C:\Websites\beta.lawfirm.org.ua\"
AppDomain.CurrentDomain.RelativeSearchPath -> "C:\Websites\beta.lawfirm.org.ua\bin"
Mar 23, 2015 at 1:01 PM
Found what was the problem, ClearScript needed C++ redistributable 2012, while I've installed 2013 one.