I recently installed Windows 7, 64 bit on my machine to try my hands at 64 bit, the website always worked fine on 32 bit Windows 7 (VS 2008 was development environment).
This website is being developed on Visual Studio 2008 targeting .Net 3.5 fx and ASP .NET MVC1.
On this 64 bit machine, I installed VS 2010 and started using it for the website (we are looking at migrating to VS2010 and also planning to deploy our website on 64 bit machine). The website built perfectly fine on VS 2010.
But when I opened the website, it gave the following error.
Server Error in '/' Application.
is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
Here is the trace summary, for the above error.
I even tried running aspnet_regiis -i for .Net 2.0 in c:\windows\Microsoft .Net\Framework64.
Then, I also tried to set the app-pool in 32 bit by enabling 32 bit in advance settings for the app pool. But even that dint work for me.
The error I got after enabling 32 bit on App Pool
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
The trace is similar to what I pasted above.
Any ideas on how can I solve this.
The solution of this error is just changing configuration of II7.
It looks like one of your dependencies is using an x86 version of an assembly. Most commonly this is something that wraps a COM object or calls native p/invoke methods.
I would start by using reflector to look at the dependencies and see if you can find the bad dependency.
Ensure that you are building your DLLs for the Platform "Any CPU" using the Configuration Manager. The system will only have difficulty if you try to access a 64bit assembly for another assembly that is flagged as 32Bit only.
You can check individual DLLs by using the SDK tool CorFlags.exe against your assemblies. This will produce an output like this:
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.
Version : v2.0.50727 CLR Header: 2.5 PE : PE32 CorFlags : 1 ILONLY : 1 32BIT : 0 Signed : 0
The 32BIT flag will be set if you are compiling the assembly for 32bit execution.
I'm not sure, but enabling FUSION logging might help you find the culprit.
The settings that I mentioned in my question helped me to run my Webapp in 32bit mode on 64 bit OS.
I dint change anything on my machine after I did as mentioned above. So my worker process runs in 32 bit mode now.
I guess we need to look at replacing some of the unmanaged dll with managed ones.
The benefits of running IIS in 32 bit on 64 bit will be that my IIS will get more address space and my in memory cache can be bigger on 64 bit.
More details on benefits of running IIS in 32 bit on 64 bit here What are the pros and cons of running IIS as 32bit vs 64bit on a 64bit OS?
User contributions licensed under CC BY-SA 3.0