Asp. NET in 64-bit Environment Development Deployment FAQ

Source: Internet
Author: User
Tags visual studio 2010

More and more development teams are starting to use 64-bit operating systems as development environments, and they plan to deploy applications on servers with 64-bit operating systems installed. For an ASP. 64-bit environment development deployment, there are a few issues that need to be noted to save time during the project.

1.ASP. NET common failures in developing deployments in 64-bit environments

Many developers use a specified 64-bit version of the library in an ASP. NET application when using a 64-bit operating system. For example, some specialized database drivers, device drivers, but the following error message is still present:

Failed to load file or assembly "..." or one of its dependencies, attempting to load an improperly formatted program.

This failure is caused by the fact that most of the ASP. NET compilers and containers are not set to 64-bit by default, but instead run in 32-bit compatibility mode. At this point, if the library is replaced with 32-bit, the system is functioning normally. If you intend to persist in using a 64-bit assembly, you can set it according to the methods described below.

2.Visual Studio iisexpress Settings

In a 64-bit operating system, Visual Studio comes with a 32-bit IIS Express. If you need Visual Studio to debug an ASP. NET app using 64-bit assemblies using IIS Express, you should use the 64-bit version of IIS Express. The Setup method is as follows:

(1) Close the running instance of IIS Express;

(2) Click the Tools-Options command on the main menu to open the Options dialog box;

(3) In the Options dialog tree "projects and Solutions"-"Web Projects" tab, tick the "64-bit version of IIS Express for sites and projects" entry.


3.Visual Studio settings when publishing a Web project

When you publish an ASP. NET project in Visual Studio, if you set the Precompilation feature during publishing, Visual Studio calls the ASP. NET compiler to compile the project.


The compiler chooses the 32-bit compiler by default, and Visual Studio does not provide any configuration management interfaces. The method for replacing the 64-bit compiler is:

(1) Find the profile name of the current publishing web, in this case the file name is Publishconfig;

(2) in the Properies directory of the Solution Explorer, locate the corresponding configuration file, open for editing;

(3) Add the following statement to the configuration file:

<aspnetcompilerpath>[microsoft. Net Framework Path]\ framework64\[version number]</aspnetcompilerpath>

For example:

<AspnetCompilerPath>C:\Windows\Microsoft.NET\Framework64\v4.0.30319</AspnetCompilerPath>

Note: The previous versions of Visual Studio 2010 are configured differently, and the corresponding solution is not currently found, and you can choose not to precompile.

IIS settings on 4.64-bit Windows Server

IIS can set whether to run in a 64-bit environment for specific ASP. NET application settings, as follows:

(1) After you deploy the Web site, open Internet Information Services (IIS) Manager;

(2) Select the application pool in the directory, select the application configuration of the target site, and open the advanced settings via the right-click menu;

(3) Set the Enable 32-bit application option to false and the app will run in a 64-bit environment.


5. Does the compiler need to set the x64 platform in the solution configuration

I looked at some of the documents and experimented on this issue. Personal views are as follows:

(1) Normal ASP. NET projects do not require platform settings, the platform settings for x86 and x64 do not affect the compilation and release of the project, so use the default any CPU platform.

(2) For projects that use an environment-restricted assembly, such as system-driven, database-driven, it is best to configure the corresponding platform. At the time of publishing the environment is abnormal, you can get more valid information and save debugging time.

Postscript

Many developers are dissatisfied with Microsoft's documentation, and software engineers, unlike lawyers ' professional attributes, are not likely to spend a lot of time daily on flipping through the code-like MSDN documentation. What we want is to be able to organize development data against the frequency of possible problems, so developers will take a lot less detours.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.