Enable the Apache server in Windows to support ASP. NET.

Source: Internet
Author: User

ASP. NET 2.0 is the latest web application development platform. As part of the. NET Framework, it is powerful, high-performance, and easy to develop. As a Microsoft product, the best web server for ASP. NET is, of course, IIS (comparison between IIS and Apache ). However, if a Windows machine has installed Apache and a web application, you cannot enable IIS (under the same port ). Fortunately, we can also support ASP. NET under Apache httpd.

Mono, the most famous open-source project dedicated to. Net cross-platform, provides an Apache plug-in mod_mono to support ASP. NET. However, mod_mono mainly targets Unix/Linux platforms. Although Windows is available, it is based on mono instead of Windows's ready-made. NET Framework, and is not updated in a timely manner. ASP. NET 2.0 cannot be well supported.

Some people have created independent web servers to support ASP. NET, but they still cannot meet our direct use of existing Apache.

In fact, Apache has provided the ASP. NET solution for a long time, that is, the mod_aspdotnet module. But this plug-in stopped development a year and a half ago. I don't know whether to give way to mono or worry that ASP. NET is developing too fast. However, we can still download it from the Apache module archive library.

Mod_aspdotnet is much more sophisticated than mod_mono, and the installation program is more than 300 K. As long as the. NET Framework is installed in the system, it can perfectly support ASP. NET, or even 2.0.

The procedure is as follows:

1. download and install the latest Apache HTTP Server (link 2.2.3 is provided here) and perform basic configuration (skip this step if the apache service is enabled ).

2. download and install the mod_aspdotnet module.

3. modify the configuration file (usually in C:/program files/Apache Group/apache2/CONF/httpd. conf) and add the following lines:

# Asp.net
Loadmodule aspdotnet_module "modules/mod_aspdotnet.so"

Addhandler Asp.net asax ascx ashx asmx aspx axd config CS csproj licx REM resources resx soap VB vbproj vsdisco webinfo

Aspnetmount/sampleasp "C:/sampleasp"
Alias/sampleasp "C:/sampleasp"
#/Sampleasp is the alias used to execute the Asp.net directory, and C:/sampleasp is its actual address

# Open the script running permission
<Directory "C:/sampleasp">
Options followsymlinks execcgi
Order allow, deny
Allow from all
Directoryindex index.htm index. aspx
# Set the default file
</Directory>

# For ASP. NET virtual pages, the following aspnet_client file is required to support client help scripts.
Aliasmatch/aspnet_client/system_web/(/d +)(/D +)(/D +)/(. *) "C:/Windows/Microsoft. NET/framework/V $1. $2. $3/asp. netclientfiles/$4"
<Directory "C:/Windows/Microsoft. NET/framework/V */asp. netclientfiles">
Options followsymlinks
Order allow, deny
Allow from all
</Directory>
# Asp.net

4. Create an ASP. NET site (create an index. aspx file) under C:/sampleasp)

5. Restart the Apache server.

6. You can use http: // localhost/sampleasp/index. aspx to check the effect.

Related Article

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.