Skip to main content
 首页 » 编程设计

c#之ASP.NET 网络应用程序 : Unable to read DLL

2024年02月23日14kuangbin

我有一个 ASP.NET 应用程序,其中添加了两个引用:MapServer 和 GDAL。这两个 DLL 使用了一堆其他 DLL,它们都在我的应用程序 /bin 目录中。

当我在自己的 PC 上使用 Visual Studio 2010 运行该应用程序时,它运行良好。当我使用 IIS 将它上传到我的 Windows 2008 服务器时,它抛出了这个异常:

Could not load file or assembly 'gdal_csharp' or one of its dependencies. 
An attempt was made to load a program with an incorrect format.  

在服务器上通过 Visual Studio 运行应用程序时运行良好。

我什至尝试将 /bin 目录添加到 PATH 环境变量,然后重新启动服务器。不过运气不好。

请您参考如下方法:

我的猜测是该 DLL 是您尝试在 x64 环境中运行的仅 32 位 DLL。您可以尝试将应用程序池设置为仅 32 位吗?

更新:这里有一个简单的说明:http://help.webcontrolcenter.com/KB/a1114/how-to-enable-a-32-bit-application-pool-in-iis7-dedicatedvps.aspx