Could not load file or assembly 'System.Data.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

1

I'm facing this problem. I've searched for all sorts of solutions for this but to no avail, finally decided ask here.

The web application is a .net 4.0 deployed with IIS in a staging server, it has been running fine up until recently. It runs fine in production and development server.

enter image description here

The web app platform is 'Any CPU' , build in x64 machine, deployed in x64 machine. But all the reference assemblies uses 32bit and the application dll is compiled to 32bit. We set the 'Enable 32-bit applications' in the IIS app pool.

Now I have recompiled the application and all it's assemblies to x86 platform and deployed to the staging server. But the same error appears again.

I have used fusion to log to see if the System.data.dll could be loaded properly as below.

enter image description here

I think it is something to do with the server, as the website runs fine in production. There was some security patching in the staging server recently too.

.net
winapi
dependencies
.net-assembly
badimageformatexception
asked on Stack Overflow Dec 7, 2016 by Ling • edited Jun 20, 2020 by Community

1 Answer

0

For this we have to check the GAC File in the following path. 1.c://windows/microsoft.net/assembly/GAC32--> replace the new 32bit system.dll 2.c://windows/microsoft.net/assembly/GAC64--> replace the new 64bit system.dll

Just now I resolved the problem by doing this.

answered on Stack Overflow Aug 29, 2017 by Suresh Babu Maddela • edited Aug 29, 2017 by Arun Vinoth

User contributions licensed under CC BY-SA 3.0