“无法加载文件或程序集“X.dll”;或其依赖项之一。找不到指定的模块。” - 在主机服务器上
X.dll 是我的 C++/CLI dll,放置在网站的 bin 文件夹中。它在本地计算机上运行正常,最初在服务器上运行正常。但我更改了托管帐户,突然出现此错误。我应该以某种方式在 web.config 中引用这个程序集吗?我听说非托管 dll 存在类似问题,但相关程序集是托管的。 完整消息:
无法加载文件或程序集“X.dll”或其依赖项之一。找不到指定的模块。在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 assemblyName,布尔 starDirective) 在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) 在System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) 在 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() 在 System.Web.Compilation.BuildManager.CallPreStartInitMethods() 在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager 、IApplicationHost 应用程序主机、IConfigMapPathFactory configMapPathFactory、HostingEnvironmentParametersHostingParameters、PolicyLevelpolicyLevel、异常appDomainCreationException)无法加载文件或程序集“X.dll”或其依赖项之一。找不到指定的模块。在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName 文件名、字符串 codeBase、证据 assemblySecurity、RuntimeAssembly locationHint、StackCrawlMark& stackMark、布尔 throwOnFileNotFound、布尔 forIntrospection、布尔抑制SecurityChecks) 在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName 文件名、字符串 codeBase、证据assemblySecurity、RuntimeAssembly locationHint、StackCrawlMark& stackMark、布尔 throwOnFileNotFound、布尔 forIntrospection、布尔抑制SecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef、证据 assemblySecurity、StackCrawlMark& stackMark、布尔 forIntrospection、布尔抑制SecurityChecks) System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 在 System.Reflection.Assembly.Load(String assemblyString) 在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) 在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 assemblyName,布尔 starDirective) 在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) 在System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) 在 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() 在 System.Web.Compilation.BuildManager.CallPreStartInitMethods() 在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager 、IApplicationHost 应用程序主机、IConfigMapPathFactory configMapPathFactory、HostingEnvironmentParameters 托管参数、PolicyLevel 策略级别、异常 appDomainCreationException)
The X.dll is my C++/CLI dll, placed in the bin folder of the website. It works OK on local machine and initially it worked OK on the server. But I changed hosting accounts and suddenly I got this error. Should I somehow reference this assembly in the web.config? I've heard there are issues like this with unmanaged dlls, but the assembly in question is managed.
Full message:
Could not load file or assembly 'X.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() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) Could not load file or assembly 'X.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, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) 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)
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() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最有可能的是,有问题的 DLL 正在尝试查找其他 DLL。
Dependency Walker 也许可以帮助您。
http://dependencywalker.com/
Most likely there is an additional DLL the DLL in question is trying to find.
Dependency Walker may be able to help you.
http://dependencywalker.com/
听起来像是一个经典的权限问题。尝试授予 Web 服务器对该文件的权限?
Sounds like a classic permssions issue. Try giving the web server permission on the file?
正如之前所说,这与缺少 DLL 有关。
我一直使用 Microsoft Process Monitor 来追踪根本原因的此类问题。
像这样使用它:
w3wp.exe
进行过滤。出现的列表有望显示一些带有
file not found
的行。As already said before, it's related to a missing DLL.
I have always used the Microsoft Process Monitor to track down the root cause of such issues.
Use it like this:
w3wp.exe
.The appearing list will hopefully show some lines with
file not found
.