非托管的Win32 DLL在.NET MVC应用程序不加载在IIS 8.5,赢服务器2012 R2,Azure的虚拟机 [英] unmanaged win32 dll not loading in .net MVC app on IIS 8.5, Win Server 2012 R2, Azure virtual machine

查看:243
本文介绍了非托管的Win32 DLL在.NET MVC应用程序不加载在IIS 8.5,赢服务器2012 R2,Azure的虚拟机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图消耗在.NET MVC应用程序一个Win32 DLL。不过,我不断收到以下错误无法加载DLL'experiment_dll.dll:指定的模块找不到

I am trying to consume a win32 DLL in a .net MVC app. However I keep getting the following error Unable to load DLL 'experiment_dll.dll': The specified module could not be found

我已经使用进程监视器捕获文件系统活动的code尝试加载DLL执行时。它表明,该DLL可以看出,大部分的文件系统操作的是一个成功

I have used Process Monitor to capture file system activity when the code trying to load the DLL executes. It shows that the DLL can be seen and most of the file system operations are a success.

文件系统活动的两个全尺寸的屏幕捕获 -

Two full size screen captures of file system activity -

<一个href=\"http://s240.photobucket.com/user/BrownWarrior/media/2014_04_25_screencapture_dllnotfound_01.jpg.html\"相对=nofollow>抓屏1

<一个href=\"http://s240.photobucket.com/user/BrownWarrior/media/2014_04_25_screencapture_dllnotfound_02.jpg.html\"相对=nofollow>抓屏2

正如你所看到的某个操作的结果之一是只读者文件锁定。难道这是为什么DLL文件无法加载,为什么错误消息说该DLL找不到原因?

As you can see one of the results of one of the operations is FILE LOCKED WITH ONLY READERS. Could this be the reason why the DLL is failing to load and why the error message is saying that the DLL could not be found?

更新:我发现这个论坛主题是说,这个结果实际上是成功的,因此不应该成为问题 - 的 http://forum.sysinternals.com/topic21378.html

UPDATE: I have found this forum thread that says that this result is actually a success and so shouldn't be the problem - http://forum.sysinternals.com/topic21378.html

如果这是一个权限问题,怎么能解决吗?我已在DLL文件并在宾根和文件夹中的应用程序池的完全控制。

If this is a permissions issue, how can it be fixed? I have already given the App Pool full control on the DLL file and on the Bin and Root folders.

我曾尝试创建一个测试MVC应用程序和测试DLL(这只是出口的单一功能,它接受一个布尔值并返回相同的布尔。我试图使测试MVC x86和DLL的Win32(均发布版本),并设置在启用32位应用程序应用程序池设置为true。我也试图使测试MVC x64和DLL的64位(包括发布版本),并设置使32位应用程序应用程序池设置为false。我也试过 CPU的任何配置,所有产生相同的错误,所有生产相同的文件系统活动中所示的屏幕捕获

I have tried creating a test MVC app and a test DLL (which just exports a single function that takes a bool and returns the same bool. I have tried making the test MVC x86 and DLL win32 (both release builds) and setting the Enable 32-Bit Applications App Pool setting to true. I have also tried making the test MVC x64 and the DLL x64 (both release builds) and setting the Enable 32-Bit Applications App Pool setting to false. I have also tried Any Cpu configurations. All produce the same error and all produce the same file system activity as shown in the screen captures.

我发布到IIS 8.5时遇到此问题,在Windows Server 2012 R2在Azure上运行虚拟机。

I am experiencing this problem when publishing to IIS 8.5, Windows Server 2012 R2 running on Azure Virtual Machine.

加载DLL没有问题发布到一个免费的,当 mywebsite.azurewebsites.net 或我的机器上运行时。

The DLL loads without issue when publishing to a free mywebsite.azurewebsites.net or when running on my development machine.

推荐答案

原来,检查服务器与Dependency Walker中的DLL,那里面安装使用Visual Studio的依赖是不是在服务器上可用,<后code> MSVCR120.dll 。起初我以为是因为我没有给该DLL的任何依赖自己,就不会有可能被遗漏的依赖。所以我忽略了它。错误的决定!

It turns out, after checking the DLL with Dependency Walker on the server, that a dependency which was installed with Visual Studio was not available on the server, MSVCR120.dll. Initially I thought that because I had not given the DLL any dependencies myself that there would not be any dependencies that could be missing. So I overlooked it. Bad decision!

这篇关于非托管的Win32 DLL在.NET MVC应用程序不加载在IIS 8.5,赢服务器2012 R2,Azure的虚拟机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆