Install and configure ASP. NET

Source: Internet
Author: User
Install and configure ASP. NET


The following body:

1.1 Step 1: Install the IIS server

IIS is an Internet Information Server on Windows. simply put, it is to build the server software for the WWW website. similar to Apache in Linux. generally, no iis is installed on users' computers, but IIS is also developed for ASP. net, although it is not a development tool, but it is also necessary. IIS installation files are usually stored on Windows Installation CDs. Therefore, you have to have your Windows installation CD, and then choose to add the IIS Windows component from the above.
After the installation is complete, the c: \ Inetpub \ wwwroot directory is the corresponding directory of your WWW server. for example, http: // localhost/xxx corresponds to the directory c: \ Inetpub \ wwwroot \ XXX. the localhost indicates the local host. of course, if someone else wants to access this machine, you need to replace localhost with the local IP address.

1.2 Step 2: Install development tools

ASP. of course, the development tool of net is Microsoft's Visual Studio. net. my own machine is installed with version 2003, usually. net will contain visual c ++, Visual C #, Visual Basic. net and other tools. ASP. net, of course, is the basis for our explanation here. net tool for developing web applications. ASP. the code of the Web application developed by. Net can be C # Or VB. net, in short, Asp. as long as the Execution Code of web pages developed by. NET is based on. net.


Sometimes, we install IIS and. net. Install it first. net, the result is that our IIS is not installed. net (such as ASP. net), the solution is very simple. in. net installation path to run an IIS registration program. in my computer, the path is c: \ windows \ Microsoft. net \ framework \ v1.1.4322, we only need to execute this program at the command prompt, namely:

C: \ windows \ Microsoft. NET \ framework \ v1.1.4322> C: \ WINDOWS \ Microsoft. NET \ framework \ v1.1.4322 \ aspnet_regiis.exe-I

Or

C: \ windows \ Microsoft. NET \ framework \ v1.1.4322> C: \ WINDOWS \ Microsoft. NET \ framework \ v1.1.4322 \ aspnet_regiis.exe/I

Prompt after execution:

Start installing ASP. NET (1.1.4322.0 ).

ASP. NET (1.1.4322.0) has been installed ).

1.3 Step 3: Use Visual Studio. NET to create a web application

First open vs. net, and then select create new project
Select the ASP. NET web application.
Then add anything to the webpage:
Click RUN web application:
The web page of the developed web application: webform1.aspx

Generally, the extension of ASP. NET web pages is Aspx.

1.4 Step 4 publish my ASP. NET web applications to other servers

This section is the most detailed part. because it involves IIS's ASP. net execution settings, web program upload, execution, and many other details, but these issues are rarely mentioned in General books, however, it is also a problem that we often encounter in practical application, so it is necessary to explain it clearly here.

We generally use. when creating a web project. net will automatically set some settings for IIS and web pages for you, so you do not need to change anything. however, if you want to place your web programs on other machines, such as public network servers, you need to manually set these items.

First, we need to know that ASP is executed on any IIS. net requires you to set the virtual directory of the web program to be executed in IIS in advance. for example, I want to create a virtual executable directory named D: \ webgame1.

Create/set a virtual directory

Open "Internet Service Manager" in "Administrative Tools" in "Control Panel" on the server and find "Default web site" in the left-side directory ", right-click the new virtual directory in the menu to enter the wizard dialog box for creating a virtual directory.

 

In the create wizard, 1 step. in the "virtual directory alias" dialog box, set a name. I still use webgame1, 2 step. on the "directory path", enter the path of the "D: \ webgame1" directory. 3 step. click Next in the access suggestion dialog box. 4. step. finally, create a virtual directory.

Of course, you do not have to create a virtual directory. In fact, you copy the webgame1 directory to c: \ Inetpub \ wwwroot \, and then in IIS, right-click its "properties" to bring up the Properties dialog box.

 

Select "CREATE (E)" in "application settings". Then, this directory is set to a virtual directory.

Test ASP. NET

After the virtual access directory is set successfully, you can put a common *. HTML webpage files are stored in this directory. then change *. aspx, via http: // localhost/XXX/xxx. aspx to test. if it can be opened, congratulations, your asp.. net.

About web applications. generally. the web programs created by net are post-code methods, that is *. aspx and *. aspx. CS separated. in *. in the aspx file, specify the location of the code file and the inherited class, as shown in <% @ page Language = "C #" codebehind = "webform1.aspx. CS "inherits =" webgame1.webform1 "%> here codebehind is ours *. aspx. where the CS code file is located, inherits is the class name of the specified web form. generally, it is best to compile the CS code, convert it to a DLL, and upload it to the virtual directory on the server. you only need to remove the codebehind item. however, inherits must specify the class of the web form. note 1:. after the code is compiled, a bin directory is generated in the project directory, which stores a file named webgame1.dll. when uploading the server, you need to upload the bin directory (including the DLL files) to the root directory of the virtual directory, for example, the virtual directory D: \ webgame1 created earlier, the uploaded file is D: \ webgame1 \ bin. your *. in the aspx directory, "inherits =" webgame1.webform1 "indicates this *. the code of the aspx web form is the webform1 web class in the webgame1.dll file in the virtual directory \ bin. NOTE 2: If there is no special need, in general, *. aspx and bin directories, we 'd better not put other. files in the. Net project are uploaded to the virtual directory of the server. Otherwise, an access error is often prompted (in short, I 've been stuck with this problem for a long time and I don't know what's going on ).

Create a web application installation and deployment Program

1. Open your. net, right-click your project (solution), and select Add new project (add new project ).

2. Select the Web Setup Project (Web installation project) of setup and deployment projects ). (Note the storage path of the setupproject. Usually by default)

3. The vs window displays the File System (you setup name ). Click the plus sign of "Web application folder" in the left column, right-click "Web application folder", select "add project output", and select primary output and content files.

4. A new yousetupname project will be added to your project, which is the installed project. Save it. Sometimes an error occurs.

5. Because the. XML,. Rpt, And. GIF files cannot be automatically added to the project, you must add them manually. In Solution Explorer, right-click the yousetup Project (your installation project name), select "add file", and add your. Rpt,. XML, and. GIF files;

6. If you use crystal report, add the support file for Crystal reprot. In Solution Explorer, right-click the yousetup Project (your installation project name), select "add merging module", find it in the window, and select C: \ Program Files \ common files \ merge modules \ dotnetcrystalreports. MSM. Open it and add it;

7. Right-click "File System on the target computer", select properties, and set productname to "Name of the project you want to package" in the Properties window"

8. Right-click "Web application folder" and select properties. In the Properties window, set defaultdocument to "your default logon page", that is, "start page ",

9. Select Your yousetupname project, right-click and select "generate"; or select "generate yoursetupfilename" in "generate" of the main menu ";

10. then, there will be a yousetupname folder under the storage path of c: \ Documents and Settings \ Administrator \ My Documents ents \ Visual Studio projects \ kaoqin \ file, and a debug folder below, all the files under debug are required.

11. Test the files under debug folder on the machine you want to install, and then install the files. If there is a database, you can restore the database in advance and use it.
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.