问题
Like a lot of others I'm receiving the following error when deploying my ASP.Net MVC application:
Cannot load V8 interface assembly; verify that the following files are installed with your application: ClearScriptV8-32.dll, ClearScriptV8-64.dll, v8-ia32.dll, v8-x64.dll
Clearscript was installed as part of an effort to transform less files on the fly for page requests.
I have tested my application locally in ISS Express and ISS without a hitch.
As suggested here http://clearscript3.rssing.com/chan-14849437/all_p12.html I've also included the missing code libraries as resources to my project.
ClearScriptV8-32.dll
, ClearScriptV8-64.dll
, v8-ia32.dll
, v8-x64.dll
are all included in a folder ClearScript.V8 in the bin folder. Removing this folder does not resolve the issue.
At my wits end. Any help is appreciated.
回答1:
This was seconds time starting some project with clearscript v8, and good I remembered what was the issue first time. Loading Native Lib v8.
You would think somewhere in GETTING STARTED or similar topic, devs from ClearScript should have mentioned that you need to have V8 native lib located in subfolders 'ia32' or 'x64' (Platform x86 or Platform x64 respectfully). Create above subfolders. and place native v8 libs there (32bit into 'ia32', 64bit in 'x64').
I guess they forgot to write down that thought. just as reminder... source code taken from loader that helped me last time track the issue...
private static IntPtr LoadNativeLibrary()
{
var suffix = Environment.Is64BitProcess ? "x64" : "ia32";
var fileName = "v8-" + suffix + ".dll";
var messageBuilder = new StringBuilder();
var paths = GetDirPaths().Select(dirPath => Path.Combine(dirPath, deploymentDirName, fileName)).Distinct();
foreach (var path in paths)
{
var hLibrary = NativeMethods.LoadLibraryW(path);
if (hLibrary != IntPtr.Zero)
{
return hLibrary;
}
var exception = new Win32Exception();
messageBuilder.AppendInvariant("\n{0}: {1}", path, MiscHelpers.EnsureNonBlank(exception.Message, "Unknown error"));
}
var message = MiscHelpers.FormatInvariant("Cannot load V8 interface assembly. Load failure information for {0}:{1}", fileName, messageBuilder);
throw new TypeLoadException(message);
}
Oddly enough, this loader should have thrown more meaningful message in debug environment, but it didn't. Instead we have : FileNotFoundException with message "Could not load file or assembly 'ClearScriptV8' or one of its dependencies. The system cannot find the file specified.". Guess there in code elsewhere is another similar loader that actually doesn't use LoadLibrary but falls back to .Net default loader, giving meaningless Exception.
hope this helps others solve similar issues.
回答2:
the cause is that asp.net load instantly all libraries in /bin directory. I added the following rule to ignore Clearscript assemblies, and it worked
<configuration>
<system.diagnostics>
<trace autoflush="true" />
</system.diagnostics>
<system.web>
<compilation>
<assemblies>
<remove assembly="ClearScriptV8-64" />
<remove assembly="ClearScriptV8-32" />
....
</assemblies>
</compilation>
...
回答3:
To be clear this exception is not always caused by a missing ClearScriptV8-32.dll
, ClearScriptV8-64.dll
, v8-ia32.dll
or v8-x64.dll
. Oftentimes the issue is that a dll referenced by one of the aforementioned dlls cannot be found. In cases where the appropriate dlls are on the server installing the appropriate Visual C++ Redistributable will usually solve this transitive dependency issue.
According to the project's discussion forum ClearScript no longer supports Visual Studio 2012. Meaning the version of the Visual C++ Redistributable that needs to be installed on your server is dependent on the version of ClearScript your project is utilizing:
- ClearScript Versions 5.0 - 5.3: Visual C++ Redistributable for Visual Studio 2012
- ClearScript Versions 5.4 - .....: Visual C++ Redistributable for Visual Studio 2013
回答4:
Might be a bit late but this may help others coming to this post.
This is a common error when you don't have the Visual C++ Redistributable for Visual Studio 2012 or above installed on the hosting server
http://www.microsoft.com/en-gb/download/details.aspx?id=30679
回答5:
If you're deploying on Windows Server 2012 with IIS role, there are two things you should do to get ClearScriptV8 running:
- As @no1sprite pointed out:
you have to install on the hosting server the Visual C++ Redistributable for Visual Studio 2012 or above: http://www.microsoft.com/en-gb/download/details.aspx?id=30679
- Make sure you place ClearScript.dll in website's bin\ folder, and ClearScriptV8-64.dll and v8-x64.dll into bin\ClearScript.V8.
Optional, for 32-bit applications/platforms:
- If you use 32-bit platform, place ClearScriptV8-32.dll and v8-ia32.dll in website's bin\ClearScript.V8\ folder. Also, In IIS Manager, right-click on site's Application pool and select "Advanced settings...". Set property "Enable 32-bit applications" to true.
回答6:
None of the answers worked for me. It is a Windows Service application.
Based on accepted answer; I removed v8-ia32.dll & ClearScriptV8-32.dll (since my application is targeting x64)
It solved the issue.
来源:https://stackoverflow.com/questions/23301851/clearscript-files-cannot-be-found-on-host