Using V8 in mvc is not working

Jun 30, 2013 at 4:28 AM
Looks like V8 does some type of reflection and loading of assemblies behind the scenes. doesn't seem to like that. Probably because its running in a web context and the base directory is coming back wrong.

Is there a way you can get this to work? Using it for a project.
Jun 30, 2013 at 4:54 AM

I turned on assembly logging and this is what I got.

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = Lisa\Donny
LOG: DisplayName = V8.Net.Proxy.Interface.x64
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: V8.Net.Proxy.Interface.x64 | Domain ID: 4
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/Donny/Documents/GitHub/QueHacer/QueHacer/QueHacer/
LOG: Initial PrivatePath = C:\Users\Donny\Documents\GitHub\QueHacer\QueHacer\QueHacer\bin

Calling assembly : (Unknown).

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Donny\Documents\GitHub\QueHacer\QueHacer\QueHacer\web.config
LOG: Using host configuration file: C:\Users\Donny\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Donny/AppData/Local/Temp/Temporary ASP.NET Files/root/2a1027da/fc6bb8fb/V8.Net.Proxy.Interface.x64.DLL.
LOG: Attempting download of new URL file:///C:/Users/Donny/AppData/Local/Temp/Temporary ASP.NET Files/root/2a1027da/fc6bb8fb/V8.Net.Proxy.Interface.x64/V8.Net.Proxy.Interface.x64.DLL.
LOG: Attempting download of new URL file:///C:/Users/Donny/Documents/GitHub/QueHacer/QueHacer/QueHacer/bin/V8.Net.Proxy.Interface.x64.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Jun 30, 2013 at 7:18 AM
Edited Jun 30, 2013 at 7:27 AM
The "incorrect format" error means the bit-depth is incorrect (a 64-bit DLL trying to load a 32-bit one, or vice versa). Make sure to only load V8.NET.dll and V8.NET.SharedTypes.dll only. The V8.NET.dll will look in the assemblies location, not the working directory, so that should be fine.

See the "DLL Files Required For Your Projects" section in the documentation for more details.

One other thing to keep in mind is that the VC++ redistributable libraries are required (if run on a system without VS2012):
I'm working to remove the need to install this, and trying to redesign a better way for the DLLs to load.
Jun 30, 2013 at 12:20 PM
Edited Jun 30, 2013 at 1:42 PM
V8 is getting called from a dll library i built around it.
I then call that library in a mvc project. The dll library works fine using a test form but when called from I get this error. All the files needed are in the biIn folder.

I'm doing this on my dev box.
Jun 30, 2013 at 4:54 PM
I have a new release coming that helps resolves some issues with the platform types (32/64 bit libraries). Can you zip and send your project so I can test it?

Jun 30, 2013 at 7:49 PM
Edited Jun 30, 2013 at 8:05 PM
Please try testing with this most recent compile of the libraries. The arrangement of these libraries is completely new, and seems to work better.

*** Make sure to right click and unblock the ZIP file before extracting ***
Jun 30, 2013 at 10:13 PM
Still getting an error.
[FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)]
System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence) +0
System.Reflection.Assembly.LoadFile(String path) +71
V8.Net.V8Engine.Resolver(Object sender, ResolveEventArgs args) +317
System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName) +224

[FileNotFoundException: Could not load file or assembly 'V8.Net.Proxy.Interface, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
V8.Net.V8Engine..ctor() +0
enosql.EnosqlEngine..ctor(String dbasePath) in c:\Users\Donny\Documents\Visual Studio 2012\Projects\enosql\enosql\EnosqlEngine.cs:34
enosql.EnosqlEnginePool.GetInstance(String dbasePath) in c:\Users\Donny\Documents\Visual Studio 2012\Projects\enosql\enosql\EnosqlEnginePool.cs:53
enosql.EnosqlDatabase..ctor(String dbasePath) in c:\Users\Donny\Documents\Visual Studio 2012\Projects\enosql\enosql\EnosqlDatabase.cs:30
WebTest.Controllers.MainController.Index() in c:\Users\Donny\Documents\Visual Studio 2012\Projects\enosql\WebTest\Controllers\MainController.cs:18
lambda_method(Closure , ControllerBase , Object[] ) +101
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +211
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +10
1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +57
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +223
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9628700
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Jun 30, 2013 at 10:18 PM

I’ve never tested with a web project (never thought anyone would use it for that ;) ). I’d be happy to take a look at the source and investigate for you.

Jun 30, 2013 at 10:21 PM
One thing you can try: Copy all the DLLs into ONE folder (you will have to choose either x86 OR x64 and copy into the parent folder). That may help - but you have to know in advance what bit-depth the V8.NET DLL will load in (depends on your project settings, and IIS App Pool settings).
Jun 30, 2013 at 10:34 PM
Edited Jul 1, 2013 at 12:06 AM
That worked! I thought maybe you had code in your dll to pick a certain folder depending on the system. Thats why I left the folders in there.

No that actually didn't work.
Jun 30, 2013 at 11:12 PM
I do, but it seems the code for getting the location of the executing assembly may be in error. I'm investigating now. The folders are normally required, but if you know in advance, you can copy to the parent and the system will detect them locally.
Jul 1, 2013 at 1:43 AM

Try these new (debug) versions of the DLLs:

I’ve added ASP.NET support as well (for assembly locations), and better detection for loading the DLLs. The error message is also more informative if there’s a problem loading the interface DLL. Be sure to unblock the zip file before extracting (in file properties, if relevant). Keep sub folders as they are (the expected usage) and try again (be sure to remove all other V8.NET DLLs to be sure).

Jul 1, 2013 at 1:54 AM
Edited Jul 1, 2013 at 1:55 AM
Just to add: If "V8.Net.Proxy.Interface.dll" is in the same folder as the V8.NET.dll (and all other related files), then the V8.NET assembly resolver (a .NET thing) won't need to execute, so everything resolves automatically ... but you will be locked into only that platform (x86/x64). :)

Under ASP.NET, the DLLs are shadow copied, so that may break the above (x86 or x64 sub-folders will be required).
Jul 1, 2013 at 3:20 AM
Notice: Re-download the DLLs from the link above to get the debug update build. It fixes an index error on 32-bit systems.