【发布时间】:2018-03-01 23:11:18
【问题描述】:
我已经看到票 “Could not load file or assembly 'Magick.NET-x86.DLL' or one of its dependencies” by Harsh Gupta 并且我遇到了同样的问题,但没有这些解决方案适合我。
我有一个包含 ImageMagick 的 Web 应用程序,它新安装在新的 Windows Server 2012 实例(我们正在从 Windows Server 2008 R2 实例迁移到该实例)上。该应用程序在 Server 2008 和本地运行正常,但在 Server 2012 上运行不正常。
我在将 Magick.Net 从 6.8.7.502 升级到 7.0.7.300 后重建了项目,希望在 7.0.6 中引入的.Net Standard / .Net Core support mentioned in the Readme 可以解决我的问题,但无济于事。在此之前,我还安装了 VC++ 2012 和 2015,正如 Harsh Gupta 提到的 in their accepted answer。
尽管如此,我仍然收到“HTTP 错误 500.0 - 内部服务器错误”页面,告诉我:
模块: AspNetInitializationExceptionModule
通知: BeginRequest
处理程序: ExtensionlessUrlHandler-Integrated-4.0
错误代码: 0x00000000
请求的 URL: [已编辑]
物理路径: [已编辑,但正确]
登录方法:尚未确定
登录用户:尚未确定
事件日志显示来自 ASP.NET 4.0.30319.0 的警告事件,事件 ID 为 1310 和以下堆栈跟踪:
Event code: 3008
Event message: A configuration error has occurred.
Event time: 9/20/2017 6:20:40 PM
Event time (UTC): 9/20/2017 6:20:40 PM
Event ID: 4775ecdb4601401ca30aa057f77ae78a
Event sequence: 1
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: [redacted]
Trust level: Full
Application Virtual Path: /
Application Path: [redacted]
Machine name: [redacted]
Process information:
Process ID: 5096
Process name: w3wp.exe
Account name: IIS APPPOOL\[redacted]
Exception information:
Exception type: ConfigurationErrorsException
Exception message: Could not load file or assembly 'Magick.NET-x86.DLL' or one of its dependencies. The specified module could not be found.
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Could not load file or assembly 'Magick.NET-x86.DLL' or one of its dependencies. The specified module could not be found.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
Request information:
Request URL: [redacted]
Request path: /
User host address: [redacted]
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\[redacted]
Thread information:
Thread ID: 8
Thread account name: IIS APPPOOL\[redacted]
Is impersonating: False
Stack trace: at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Custom event details:
查看 webroot,bin 文件夹确实包含 Magick.NET-x86.dll(以及 Magick.NET-Q16-x86.dll 和 Magick.NET-Q16-x86.Native.dll)和 @ 987654329@ 组确实拥有对这些 DLL(以及所有其他 DLL)的读取权限。
虽然它是 64 位服务器,但 AppPool 确实将启用 32 位应用程序设置为 True。将 AppPool 的 Managed Pipeline Mode 从 Integrated 更改为 Classic 也没有效果。但是,我确实注意到,AppPool 的应用程序数量被列为零(尽管网站的高级设置对话框显示了正确的 AppPool 名称):
我完全不知所措,我们现在在迁移此应用程序方面落后于计划,因此我们将不胜感激地收到任何建议。
谢谢!
编辑添加:票#107 on Github有更多信息。
【问题讨论】:
-
您说这是一个新服务器,您是否尝试使用
regiis安装asp.net? -
@Webruster ASP.Net 已安装(使用服务器管理器中的角色和功能向导)。最初情况并非如此,因此我们(不出所料)看到了不同的错误消息。问题中的错误是在 ASP.Net 运行后才出现的。
-
安装VC++ 2012后是否尝试重启服务器?
-
@Webruster 服务器不在生产环境中使用,所以我相信它会在一夜之间关闭(因此经常重启)。我现在将手动重新设置它,看看是否可以解决任何问题:)
-
@Webruster 我刚刚手动重启了它,并没有改变任何东西:(
标签: asp.net iis-8 assembly-loading imagemagick.net