Scenario: When we use VS2005 to develop a web program and run normally on a 32-bit operating system of WIN2003 or WIN2008, we deploy the program to the 64-bit operating system of win2008 R2 (note: currently, win2008 R2 only supports 64-bit operating systems.
Server Error in '/CMISWebAdminDevelopment' 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)
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. |
Stack Trace:
[BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)] System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +495 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192 System.Reflection.Assembly.Load(String assemblyString) +42 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +182
[ConfigurationErrorsException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +1259 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +145 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +30 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +227 System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76 System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +856 System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +239 System.Web.Compilation.BuildManager.CompileCodeDirectories() +599 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +767
[HttpException (0x80004005): is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)] System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1168 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +906
[HttpException (0x80004005): is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +709 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +317 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +595
|
Version Information:Microsoft. NET Framework Version: 2.0.50727.42; ASP. NET Version: 2.0.50727.42
The solve method is as follows:
1. Inside IIS (7) click on Application Pools.
2. Find the Application Pool that is configured for your web application in the list.
3. Select it, then click Advanced Settings on the right.
4. Second setting in the list: Enable 32-Bit Applications-must be set to True.
5. identity-shocould be set to localsystem
Note: the operating system is in English, so most of the information is in English.