Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a .net4 web application running in a 64 bits 2008 server. I can only get it to run when I set the app pool to Enable 32-bits application to true. All dlls are compiled for .net4 (verified with corflags.exe). How can I figure out why Enable 32-bit is required?

The error message from the event log when starting as a 64-bit app-pool

Event code: 3008 Event message: A configuration error has occurred. Event time: 2011-03-16 08:55:46 Event time (UTC): 2011-03-16 07:55:46 Event ID: 3c209480ff1c4495bede2e26924be46a Event sequence: 1 Event occurrence: 1 Event detail code: 0

Application information: Application domain: removed Trust level: Full Application Virtual Path: removed Application Path: removed Machine name: NMLABB-EXT01

Process information: Process ID: 4324 Process name: w3wp.exe Account name: removed

Exception information: Exception type: ConfigurationErrorsException Exception message: Could not load file or assembly 'System.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format. at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) at System.Web.Compilation.BuildManager.CallPreStartInitMethods() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'System.Data' or one of its dependencies. An attempt was made to load a program with an incorrect format. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

Request information: Request URL: "our url" Request path: "url" User host address: ip-adddress User:
Is authenticated: False Authentication Type:
Thread account name: "app-pool"

Thread information: Thread ID: 6 Thread account name: "app-pool" Is impersonating: False Stack trace: at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() at System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) at System.Web.Compilation.BuildManager.CallPreStartInitMethods() at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Custom event details:

share|improve this question
    
Did you compile all of the DLLs for a 64bit environment? –  Hyppy Mar 15 '11 at 15:39
    
They have been compiled with "Any CPU". –  Jonas Lincoln Mar 15 '11 at 15:49
1  
What happens when you use a 64-bit app pool? –  TristanK Mar 16 '11 at 1:47
add comment

1 Answer 1

up vote 2 down vote accepted

Most likely, because one or more of the components used by your application are 32-bit.

Or, because one or more components used by your application are not found when you toggle the App Pool mode, because of their bitness, and file system redirection.

Generally speaking, IIS will divide up Modules and Handlers into 32- and 64-bit binaries, and prevent one bitness or another from seeing the other bitness with the bitness32 or bitness64 preconditions.

Top-of-head example:

<modules> <module name="something" path="c:\program files\something.dll" precondition="bitness64"> </modules>

If you change the app pool to 32 bit, keep in mind:

  • bitness64 won't be true
  • 64 bit apps aren't lied to about file locations; 32 bit apps might be (Program Files (x86), or System32 (which redirects to SysWow64))

the same module/handler might have an entry like this:

<modules> <module name="something32" path="c:\program files\something32.dll" precondition="bitness32"> </modules>

Which will only work if something32.dll is in Program files (x86).

The event logs should help you track down which module is being problematic, if it's a module or handler load failure.

If your modules or handlers don't specify a bitness precondition, and might use different paths when run from a different bitness due to redirection, you've got your problem. (the event logs will typically point you at what failed to load when an App Pool won't start).

See also:

share|improve this answer
    
Very good answer! I have no modules in my web.config, and the problematic dll when loading the app is System.Data. Which seems weird. –  Jonas Lincoln Mar 16 '11 at 7:11
    
Ah - looks like a reference issue - I'm not sure how you address that without explicit builds - similar issue here: stackoverflow.com/questions/1443594/… –  TristanK Mar 16 '11 at 21:19
    
    
Ok, with your help, we finally found the problem. We're using a 32 bit build server deploy to 64 bit production servers, and when the applications were built the build server added a few 32 bit system dlls to the /bin folder. when we removed them, everything worked. –  Jonas Lincoln Apr 14 '11 at 6:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.