当我使用 VS 在本地运行网站时,一切正常。
我正在使用 P/Invoke 调用 dll 中的一个函数。 DLL 在 C++ 中并且可以工作。
当我在 IIS 上部署网站时,我收到错误消息
Unable to load DLL 'SolvingProbelm.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
dll 位于 bin 文件夹中。应用程序池是 Classic 和 .net 2.0
如有任何建议,我们将不胜感激。
问候
最佳答案
我曾经遇到过类似的问题。只需将 SolvingProbelm.dll
复制到 C:\WINDOWS\System32
。希望它能奏效!它在我的情况下有效。实际上, native DLL 和 .Net DLL 的搜索方式不同。 IIS 也在 C:\Windows\System32
文件夹中搜索 native DLL。因此,在那里复制您的 DLL 可以解决问题!
关于c# - 网站在 IIS 中运行时无法找到 DLL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4948460/