ASP.NET MVC;编译为64位的x64与anyCPU,有区别吗? [英] ASP.NET MVC; compiling to x64 versus anyCPU for 64bit, difference?

查看:55
本文介绍了ASP.NET MVC;编译为64位的x64与anyCPU,有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Visual Studio 2017,ASP.NET 4.7和MVC 5,以针对IIS Express和Azure App Services进行开发.

I am running Visual Studio 2017, ASP.NET 4.7 and MVC 5, for developing against IIS Express and Azure App Services.

当前为32位.我想将其转换为64位

It is currently 32bit. I want to convert it to 64bit

我看到2个选项:

  1. 通过活动"标签在解决方案的配置中明确设置 x64 .

通过活动"选项卡在解决方案的配置中明确设置 AnyCPU .

Explicitly setting AnyCPU in the Solution's configuration via the "Active tab.

我已将IIS Express设置为64位,并将Azure App Service实例设置为64位.

I have set IIS Express to 64bit and will have set the Azure App Service instance to 64bit.

我认为2)是最佳实践,因为将提高Web服务器目标位数.

I have a feeling that 2) is best practice since the web server target bitness will be picked up.

如果有所作为,可能会使用一些第三方32位dll.

There may be a few third party 32bit dlls in use if this makes a difference.

谢谢.

推荐答案

  1. 如果您的项目仅使用托管DLL或Nuget包,则任何CPU都可以.AnyCPU意味着在运行时它将根据您的CPU位数决定64位还是32位.

  1. If your project is only using Managed DLL or Nuget package then Any CPU would be fine. AnyCPU means at runtime it will decide 64bit or 32bit based on your CPU bitness.

现在,如果您明确希望告诉您的程序应以32位模式还是64位模式运行,则必须选择该特定配置文件.

Now if you explicitly want to tell that your program should run in 32bit mode or 64bit mode then you have to choose that specific profile.

例如:我使用的是非托管DLL,它是专门为64bit编写的,因此AnyCPU会产生问题,因为它不是在编译时决定的.同样适用于32bit.在这里,我们明确尝试告诉它必须在特定的位配置文件中运行.

For example : I am using unmanaged DLL and that is specially written for 64bit then AnyCPU will create problem as it is not decided at compile time. Same goes for 32bit as well. Here we explicitly try to tell that it must run in specific bit ness profile.

在IIS级别上,此配置也可用,就像您可以将32位dll设置为在应用程序池级别上运行.

At IIS Level too this configuration available like you can set 32bit dll to run at App Pool Level.

评论后更新.

  1. 如果您为App Service寻找32位实例,则只有很少一部分.免费和共享.大多数都是64位的.

注意:1.在现实生活中,我也遇到过这样的问题,其中azure应用程序依赖于32位,而我们的层是64位.2.如果继续前进并选择VM,则将获得所有选项.

Note: 1. In real life too I have faced such issue in which azure app depends on 32bit and our tier was 64bit. 2. If you go bit ahead and choose VM then you will get all option.

这篇关于ASP.NET MVC;编译为64位的x64与anyCPU,有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆