简体   繁体   中英

ASP.NET web application: Unable to read DLL

I have an ASP.NET application, which has two references added: MapServer and GDAL. These two DLL's uses a bunch of other DLL's, and all of them are in my applications /bin directory.

When I run the application on my own PC in Visual Studio 2010 it runs fine. When I upload it to my Windows 2008 server with IIS it throws this exception:

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.

I've even tried adding the /bin directory to the PATH enviroment variable, and restarting the server. 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. Can you try to set the app-pool to 32-bit only?

Update: a simple instruction is here: 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.

To see whats happening you could try turning on Fusion Logging , this will enable you to view all of the assembly load failures.

Back to Basics: Using Fusion Log Viewer to Debug Obscure Loader Errors

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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