如何构建64位asp.net项目?

如何构建64位asp.net项目?,asp.net,64-bit,exception,Asp.net,64 Bit,Exception,我创建了一个新项目build and run,它要求我修改web.config进行调试,我单击了yes。这辆车很好。我将目标cpu从任意位切换到64位,结果出现异常。如何构建和运行64位项目 Server Error in '/' Application. Could not load file or assembly 'x64Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependenci

我创建了一个新项目build and run,它要求我修改web.config进行调试,我单击了yes。这辆车很好。我将目标cpu从任意位切换到64位,结果出现异常。如何构建和运行64位项目

Server Error in '/' Application.
Could not load file or assembly 'x64Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
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: Could not load file or assembly 'x64Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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: Could not load file or assembly 'x64Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly 'x64Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
   System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +163
   System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53
   System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +175
   System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +86
   System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +261
   System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
   System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
   System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927 

您可以将目标cpu保留在“Any”上,这将适用于32位和64位系统

(从错误消息判断,似乎您尝试运行它的实际上不是64位系统。)

如果将目标指定为“x64”,则编译的目标仍然完全相同。唯一的区别是程序集具有一个标志,该标志将其限制为仅在64位系统上使用


基本上,将程序集限制为64位的唯一原因是,如果您使用的是为64位系统编译的非托管库。

您可以将目标cpu保留在“Any”上,这将适用于32位和64位系统

(从错误消息判断,似乎您尝试运行它的实际上不是64位系统。)

如果将目标指定为“x64”,则编译的目标仍然完全相同。唯一的区别是程序集具有一个标志,该标志将其限制为仅在64位系统上使用


基本上,将程序集限制为64位的唯一原因是,如果您使用的是为64位系统编译的非托管库。

奇怪。但这又有什么关系呢。我已经安装了win7。我需要一个单独的框架吗。IIRC我使用的是visual studio 2008 proinstall@acidzombie24:也可能是您在32位模式下运行IIS。(如果你也在it框架1.1中运行web应用程序,这是必需的。)@o.k.w:我认为你是对的。哈哈。它的Visual Studio Web服务器。我不知道如何更改它,但可能是因为它没有64位框架吗?@acidzombie24:visualstudio是一个32位的应用程序,它的内部web服务器也是如此。因此,它的工作方式与32位模式下的IIS类似。您需要以64位模式运行的完整版本IIS才能运行64位web应用程序。奇怪。但这又有什么关系呢。我已经安装了win7。我需要一个单独的框架吗。IIRC我使用的是visual studio 2008 proinstall@acidzombie24:也可能是您在32位模式下运行IIS。(如果你也在it框架1.1中运行web应用程序,这是必需的。)@o.k.w:我认为你是对的。哈哈。它的Visual Studio Web服务器。我不知道如何更改它,但可能是因为它没有64位框架吗?@acidzombie24:visualstudio是一个32位的应用程序,它的内部web服务器也是如此。因此,它的工作方式与32位模式下的IIS类似。您需要以64位模式运行的完整版本IIS才能运行64位web应用程序。