为什么我的应用程序在IIS7.5中需要32位模式?

我有一个运行在64位2008服务器上的.net4 web应用程序。 我只能让它运行,当我设置应用程序池启用32位应用程序为true。 所有的dll都是为.net4编译的(用corflags.exevalidation)。 我怎样才能找出为什么要启用32位是必需的?

从64位应用程序池启动时,事件日志中的错误消息

事件代码:3008事件消息:发生configuration错误。 事件时间:2011-03-16 08:55:46事件时间(UTC):2011-03-16 07:55:46事件ID:3c209480ff1c4495bede2e26924be46a事件序列:1事件发生:1事件详细信息代码:0

应用程序信息:应用程序域:已删除信任级别:完整应用程序虚拟path:已删除应用程序path:已删除机器名称:NMLABB-EXT01

进程信息:进程ID:4324进程名称:w3wp.exe帐户名称:已删除

exception信息:exceptiontypes:ConfigurationErrorsExceptionexception消息:无法加载文件或程序集“System.Data”或其某个依赖项。 试图加载格式不正确的程序。 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)在System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()在System.Web.Configuration.AssemblyInfo.get_AssemblyInternal()在System.Web.Compilation.BuildManager。在System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)System.Web.Compilation.BuildManager.CallPreStartInitMethods()上的GetReferencedAssemblies(CompilationSection compConfig)

无法加载文件或程序集“System.Data”或它的一个依赖项。 试图加载格式不正确的程序。 在System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,StackCrawlMark&stackMark)System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks) ,布尔forIntrospection,布尔suppressSecurityChecks)在System.Reflection.RoadAssemblyHelper System.Web.Configuration.Assembly.Load(stringassemblyString)上System.Reflection.RuntimeAssembly.InternalLoad(stringassemblyString,证据assemblySecurity,StackCrawlMark&stackMark,布尔forIntrospection) (stringassemblyName,布尔starDirective)

请求信息:请求URL:“我们的URL”请求path:“url”用户主机地址:ip-adddress用户:
通过身份validation:False身份validationtypes:
线程帐户名称:“app-pool”

线程信息:线程ID:6线程帐户名称:“app-pool”模拟:False堆栈跟踪:在System.Web.Configuration.CompilationSection.LoadAssemblyHelper(stringassemblyName,布尔starDirective)在System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory ()System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConig)System.Web.Compilation.BuildManager.CallPreStartInitMethods()System.Web.Hosting.HostingEnvironment.Initialize上System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() (ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)

自定义活动详情:

很有可能,因为您的应用程序使用的一个或多个组件是32位的。

或者,因为应用程序使用的一个或多个组件由于其位数和文件系统redirect而在切换“应用程序池”模式时找不到。

一般来说,IIS会将模块和处理程序分成32位和64位的二进制文件,并且防止一个位或另一个位以32位或64位的前提条件来看别的位。

顶部的例子:

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

如果您将应用程序池更改为32位,请记住:

  • bitness64不会是真的
  • 64位应用程序不是骗人的文件位置; 32位应用程序可能是(Program Files(x86)或System32(redirect到SysWow64))

相同的模块/处理程序可能会有这样的条目:

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

这只会在程序文件(x86)中的some32.dll时才起作用。

事件日志应该帮助你跟踪哪个模块有问题,如果是模块或者处理程序加载失败。

如果您的模块或处理程序没有指定一个位的前提条件,并可能使用不同的path,由于redirect从一个不同的位运行,你有你的问题。 (当应用程序池不能启动时,事件日志通常会指向你无法加载的东西)。

也可以看看:

  • registryredirect
  • 文件系统redirect
  • 32位应用程序页面的概述