Document directory
Category:. NET Framework 12339 views (2) Reports iisasp. netmicrosoftinternet. netwindows
Reason:When a 32-bit project is published in IIS In a 64-bit operating system, the error "the DLL on which the project depends cannot be read and the program in incorrect format is attempted to be loaded" is reported.
Cause:The communication between assemblies is either 64-bit or 32-bit. Hybrid editing is not allowed. Otherwise, the error "trying to load a program with incorrect format" may occur.
Solution:
[C/S]
Running the C/S program is relatively simple. You can explicitly specify it as x86 (the 64-bit system defaults to x64) when building the C/S program.
[B/S]
Running B/S is a little complicated. When creating a website, there are two situations.
A: A "project" is created. This process is the same as that of C/S.
B: The website is created. You only need to modify the IIS configuration.
I) "cscript % systemdrive %/inetpub/adminscripts/adsutil. vbs set w3svc/apppools/enable32bitapponwin64 1"
(If the value of enable32bitapponwin64 is 1, a 32-bit application can be run.) You can run this item once through the command line interface. (This command enables IIS to register a 32-bit. Net FW)
Ii) by default, 64-bit op registers 64-bit. NET Framework under IIS. Therefore, you must register a 32-bit. NET Framework.
C:/Windows/Microsoft. NET/framework/v2.0.50727> aspnet_regiis.exe-I
Appendix: 64-bit Windows IIS 32-bit and 64-bit conversion methods
The 64-bit version of IIS does not support Microsoft ole db provider for jet drivers. Therefore, if you want to use ASP or Asp.net to connect to access in 64-bit windows, you need to connect IIS in 32-Bit mode. The following is a method for converting between 32-bit IIS and 64-bit IIS on 64-bit systems of other websites.
ASP. NET 2.0, 32-bit
To run the 32-bit version of ASP. NET 2.0, follow these steps:
1. Click Start, click Run, type cmd, and click OK ".
2. type the following command to enable the 32-Bit mode:
Cscript % systemdrive %/inetpub/adminscripts/adsutil. vbs set w3svc/apppools/enable32bitapponwin64 1
3. type the following command to install ASP. NET 2.0 (32-bit) and install script ing in the IIS root directory:
% SystemRoot %/Microsoft. NET/framework/v2.0.50727/aspnet_regiis.exe-I
4. Make sure that the status of ASP. NET 2.0.40607 (32-bit) is enabled in the Web Service Extension list of Internet Information Service Manager.
ASP. NET 2.0, 64-bit
To run the 64-bit version of ASP. NET 2.0, follow these steps:
1. Click Start, click Run, type cmd, and click OK ".
2. type the following command to disable the 32-Bit mode:
Cscript % systemdrive %/inetpub/adminscripts/adsutil. vbs set w3svc/apppools/enable32bitapponwin64 0
3. type the following command to install ASP. NET 2.0 and install script ing in the IIS root directory:
% SystemRoot %/Microsoft. NET/framework64/v2.0.50727/aspnet_regiis.exe-I
4. Make sure that the ASP. Net 2.0.40607 status is set to allow in the Web Service Extension list of Internet Information Service Manager.
Note: The internal version of ASP. NET 2.0 may change as the internal version of the current release changes. These steps apply to the internal version 2.0.40607.