简体   繁体   English

ASP.NET Web应用程序:无法读取DLL

[英]ASP.NET web application: Unable to read DLL

I have an ASP.NET application, which has two references added: MapServer and GDAL. 我有一个ASP.NET应用程序,它添加了两个引用:MapServer和GDAL。 These two DLL's uses a bunch of other DLL's, and all of them are in my applications /bin directory. 这两个DLL使用了一堆其他DLL,并且它们都在我的applications /bin目录中。

When I run the application on my own PC in Visual Studio 2010 it runs fine. 当我在Visual Studio 2010中在我自己的PC上运行应用程序时,运行正常。 When I upload it to my Windows 2008 server with IIS it throws this exception: 当我使用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. 

When running the application through Visual Studio on the server it runs fine. 通过服务器上的Visual Studio运行应用程序时运行正常。

I've even tried adding the /bin directory to the PATH enviroment variable, and restarting the server. 我甚至尝试将/bin目录添加到PATH环境变量中,然后重新启动服务器。 No luck though. 虽然没有运气。

My guess is that the DLL is a 32-bit only DLL that you are trying to run in a x64-environment. 我的猜测是DLL是一个32位的DLL,你试图在x64环境中运行。 Can you try to set the app-pool to 32-bit only? 您可以尝试将应用程序池设置为仅32位吗?

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

您需要在GAC注册dll: http//en.wikipedia.org/wiki/Global_Assembly_Cache

As already mentioned you may be missing something from the GAC. 如前所述,您可能遗漏了GAC的内容。

To see whats happening you could try turning on Fusion Logging , this will enable you to view all of the assembly load failures. 要查看发生了什么,您可以尝试打开Fusion Logging ,这将使您能够查看所有装配负载故障。

Back to Basics: Using Fusion Log Viewer to Debug Obscure Loader Errors 返回基础:使用Fusion Log Viewer调试隐藏的加载程序错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM