“无法加载文件或程序集“X.dll”;或其依赖项之一。找不到指定的模块。” - 在主机服务器上

发布于 2024-12-05 11:12:45 字数 2685 浏览 1 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

时光是把杀猪刀 2024-12-12 11:12:45

最有可能的是,有问题的 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/

如日中天 2024-12-12 11:12:45

听起来像是一个经典的权限问题。尝试授予 Web 服务器对该文件的权限?

Sounds like a classic permssions issue. Try giving the web server permission on the file?

七分※倦醒 2024-12-12 11:12:45

正如之前所说,这与缺少 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:

  • Use the filter button to filter by Process Name w3wp.exe.
  • Delete the existing lines using the corresponding button.
  • Then start your app and perform the action.

The appearing list will hopefully show some lines with file not found.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文