在DLL'Magick.NET-Q8-x64.Native.dll'中找不到名为'Environment_SetEnv'的入口点 [英] Unable to find an entry point named 'Environment_SetEnv' in DLL 'Magick.NET-Q8-x64.Native.dll'
问题描述
已升级到最新的ImageMagick/Magick.NET(7.0.2.901),并在本地构建并运行良好,但在服务器上爆炸并出现此错误.
Upgraded to latest ImageMagick / Magick.NET (7.0.2.901), and it built and ran fine locally, but explodes on the server with this error.
在DLL'Magick.NET-Q8-x64.Native.dll'中找不到名为'Environment_SetEnv'的入口点.
Unable to find an entry point named 'Environment_SetEnv' in DLL 'Magick.NET-Q8-x64.Native.dll'.
似乎是一个新问题.从此处的更改说明来看:
Seems to be a new issue. Judging by the change desc here:
https://magick.codeplex.com/discussions/650746
不再需要VC运行时,因此不再需要安装它们-而且,我已经为该库的早期版本安装了2008、2012和2015 VC运行时,效果很好.
The VC Runtimes are no longer required, so installing them wouldn't be the issue - and, I've installed 2008, 2012 and 2015 VC runtimes for prior versions of the library, which worked fine.
IIS中的Windows Server 2008 64位,64位.Net 4.
Windows Server 2008 64-bit, 64-bit .Net 4 in IIS.
当前解决方法是回滚到7.0.0.22,该版本运行无误.
Current workaround is to roll back to 7.0.0.22, which runs without error.
Install-Package Magick.NET-Q8-AnyCPU -Version 7.0.0.22
推荐答案
几个月前,我遇到了这个问题,最终发现了两个单独的原因:
I had this issue a couple months back and eventually found two separate causes:
-
与先前版本的任何CPU冲突
问题:Magick.NET将本机库缓存在临时目录中,除非它已经存在(
Problem: Magick.NET caches the native library in a temp directory unless it already exists (Relevant source code). Since I had previously tested with the Q8-x64 version (which doesn't test for CPU architecture), the Magick.NET-Q8-x64.Native.dll
already existed and was not overwritten.
解决方案:删除本机库的temp目录.在我的Windows版本上,它位于%TEMP%\Magick.NET.{TargetFramework}.{MagickNETVersion}
.然后,Q8-AnyCPU版本使用
Resolution: Delete the native library's temp directory. On my version of Windows, it was located at %TEMP%\Magick.NET.{TargetFramework}.{MagickNETVersion}
. The Q8-AnyCPU version then extracted a new native library with the Environment_SetEnv method.
缓存目录中权限不足
问题:本机库被缓存在具有限制的执行代码权限的目录中.
Problem: The native library was cached in a directory with restricted permissions for executing code.
解决方案:更改缓存目录的位置.我的解决方案是以下代码.
Resolution: Change the cache directory's location. My solution is the following code.
#if DEBUG
private static bool MagickCacheDirectoryIsSet = false;
public DefaultConstructor()
{
if (!MagickCacheDirectoryIsSet)
{
ImageMagick.MagickAnyCPU.CacheDirectory = @"path\to\more\permissive\directory";
MagickCacheDirectoryIsSet = true;
}
}
#endif
这篇关于在DLL'Magick.NET-Q8-x64.Native.dll'中找不到名为'Environment_SetEnv'的入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!