Configuring IIS and asp.net2.0 Web sites and environments

Source: Internet
Author: User
Tags ftp site
1. IIS Fast browsing

IIS supports the coexistence of multiple "site (Sites)" Hosts on a single server. These sites consist of IP addresses, host names, and/or port numbers.  For example, suppose my site is http://www.aspcool.com, its IP address is 192.197.157.24, the host name is www.aspcool.com, and the port number is 80 (the default HTTP port). And Nikhil's site is http://www.nikhilk.net, its server and mine on the same Web server, so, like me, it has 192.197.157.24 IP address and the default 80 port, but the only difference is that the host name is different binding. As long as there is a difference between the three (IP address, host name, and port number), you can differentiate each site and map to the IIS Web server separately

When a site is registered and IIS associated, you need to establish the home directory of the site, which indicates the address of the page file you uploaded in the future. When IIS is installed, the default site path master directory maps to the C:/inetpub/wwwroot directory, and if you place a file directly, such as test.html in that directory, you can use http://localhost/ test.html to retrieve the page information from the Web server.

In addition, in this directory, you can create any number of physical paths and subfolders, which are well supported by IIS.

IIS also holds the virtual path (fictitious directories, vdirs) This concept, as the name suggests, the virtual path is not the real path, it can map the URL into a logical path, and then map to the physical departure, which can be very good protection of files.

For example, I built a virtual path called App1 and mapped it to C:/INETPUB/APP1, then set up a text called test2.htm in the App1 directory, and combined with the default settings for IIS, the specific user request map is as follows:
Http://localhost/test.html----> c:/inetpub/wwwroot/test.html
http://localhost/app1/test2.htm---->c:/inetpub/app1/test2.htm

Note: The above wwwroot and App1 are equal, or they are in the same folder, so although from the URL logic it seems that App1 should be in the Wwwroot directory, but in fact you are not able to ensure that the actual storage is the case.

IIS also supports the concept of application (application), a concept similar to a virtual path, which also supports administrators to manage the mapping of different application pools of the heap in the IIS6 version. (Note: The concept of a asp.net application is different from the traditional ASP application, which is the portal to the application)

The application of IIS can also be mapped to a physical path under the home directory, and it can also be mapped to a path other than the home directory. They can support multiple levels of depth nesting

For example
http://www.testsite.com/-> c:/www.testsite.com/wwwroot (application's home directory)

Http://www.testsite.com/app1-> C:/www.testsite.com/app1

HTTP://WWW.TESTSITE.COM/APP2-> C:/WWW.TESTSITE.COM/APP2

HTTP://WWW.TESTSITE.COM/APP3-> C:/WWW.TESTSITE.COM/WWWROOT/APP3

HTTP://WWW.TESTSITE.COM/APP3/APP4-> C:/WWW.TESTSITE.COM/WWWROOT/APP3/APP4

Note The application's home directory (http://www.testsite.com/), App1 (HTTP://WWW.TESTSITE.COM/APP1), and app2 in the above example (http:// WWW.TESTSITE.COM/APP2), it appears from the URL path that App1 and App2 are inherited in the home directory, but are actually equal on the physical path.

In particular, when you select "Create Virtual path" In IIS, you also create an application (application), (in particular, the virtual path has automatically set some application metadata)

If you don't want these application elements, you can open the Properties page of the virtual directory you just created, and the main thing to remember is that IIS implements the binding to the virtual path, not the physical path, which determines the scope and bounds of the application.

The above mappings, if you open IIS should resemble the following you can click Delete, this does not delete the virtual path, but it will remove the application and generally does not recommend doing so.



asp.net 2.0 and application

  ASP. NET uses the IIS application metadata tokens, which are stored in the IIS metadata configuration system, to differentiate the application area of each application, and to correlate to specific host content, specifically, when a directory is mapped to a asp.net virtual path, it does the following:
(1) It allows a/bin folder to be created in the home directory of the current application to resolve the reference to the Assembler collection and to use it immediately.
(2) It allows the application set level (Application-level) to set up authentication (specifically configured in Web.config).
(3) It allows global settings (Global.asax) file definitions to handle global level events (such as Application_start/end, and specific module events such as Session_start/end)
(4) These are supported in the ASP.net 2.0 version, and in addition to the asp.net2.0 version, it also provides additional directories to deploy the application's convenience and resource sharing, and you can create these additional directories in the application's home directory, which writes additional directories including App_Data, App_Code , etc. to provide data access, class library compilation, and application resources.

is the metadata identity of IIS. For users who are familiar with Windows, you should know that Windows systems are configured in the registry, and IIS also uses the idea of a configuration file to place their configuration information in a meta database, which is what we typically call the metabase  

ASP. NET establishes a CLR's application zone to handle the context in which the application code is being allowed. This application area is in the code-loading policy settings (that is, how the application assembly is hooked up to the/bin directory), and the previous additional code access permissions issue.
Use the example above for www.testsite.com application bindings, which means that the location of the/bin folder should resemble the following:  c:/www.testsite.com/wwwroot/bin 
c:/ WWW.TESTSITE.COM/APP1/BIN&NBSP
c:/www.testsite.com/app2/bin 
C:/www.testsite.com/wwwroot/app3/bin &NBSP
C:/www.testsite.com/wwwroot/app3/app4/bin


 /app1 code at run time uses the assembly of the/app1/bin folder. The
/WWWROOT/APP3 Runtime code uses the assembly set under/wwwroot/app3/bin file
/wwwroot The Run-time code under the folder (note that the/WWWROOT/APP3 directory) will use/wwwroot/ The code under the Bin folder to load the assembly
Note: These assemblies are created by the. NET framework asp.net v1,v1.1 and V2.0 the


uses Visual Studio.NET the ""

Important: In the following description, we use the visual Web Express2005 to develop asp.net2.0. VWE2005 is a part of the visual stduio.net2005, although the vs.net2005 function is very powerful, but depending on the application (for example, some people in C #, there is no need to install the VB version) there are many features that are not really needed, So here's the VS2005 is actually VWE2005, you can go to http://www.asp.net free download
VS2005 supports a variety of ways to open and edit asp.net applications. There are four ways to sum up: File System, local IIS, FTP site, and remote Site. The following figure


This section focuses on local IIS, and other methods are described later.

Some people may ask what to do if you open a Web site by using local IIS, the site has multiple nested child applications. For example, when you open the www.testsite.com (application root directory), and the root directory contains multiple child applications (WWW.TESTSITE.COM/APP1, WWW.TESTSITE.COM/APP2, and www.testsite.com/ APP3), a widespread concern is whether VS2005 will be able to integrate all subdirectories, because bound applications and projects are compiled into the/bin directory (and in fact the/bin directory and the four applications should be different).

A very good message is that VS2005 can get the right range for each application, meaning that when you open a www.testsite.com application, the project you open in VS2005 looks something like the following


As you can see from Solution Explorer, VS2005 is only included in the Www.testsite.com application folder, and the subfolders of the application (such as the Subdirectory1 and Subdirectory2 above). So when you compile with VS2005, it compiles only the files contained within the www.testsite.com application (note that this does not include child applications). And if you deploy the Web project, your page will only deploy these main applications in www.testsite.com (excluding the child applications). This is actually the same as VS2003.

In addition, VS2005 has further improved the display of icons for nested applications in the Explorer (refer to the APP1,APP2 and app3 icons above), which enable developers to identify these applications as child applications in the web logic space. Rather than the specific file location at development time.

These sub applications do not contain specific content (this is similar to VS2003), so you cannot expand their content because they are designed to let you know that there is a child application that can quickly help you understand the architecture of the application as a whole.

It is also important to note that the above APP3 species is mapped to the C:/WWW.TESTSITE.COM/WWWROOT/APP3 physical path, which is directly in the home directory www.testsite.com application (c:/www.testsite.com/ wwwroot/), but it is marked as an application, So when you compile the www.testsite.com project, he rejects compiling the APP3 application into the main application, while Subdirectory1 and Subdirectory2 are labeled as applications, which are compiled into the main application as part of the home directory.

Another work-flow improvement point is that VS2005 allows you to add items by double-clicking the Child application icon. When you double-click on a child application (for example, double-click on APP3), the Open Web Site dialog box pops up, as shown in He's going to ask you. Open the APP3 application (which closes the current www.testsite.com application) or add the App1 application to the current www.testsite.com application.

For example, I select "Add the Web site to the" solution, and then click OK so your Solution Explorer will be divided into two items that look like the following




For example, I chose the "Add" Web site to the current solution, so that when I click the App3 icon in Solution Explorer, it appears as follows




You can use VS2005 to manage Web applications as well as child applications as you would with VS2003. A typical example of a child application nesting is the inclusion of a Web project and one or more class libraries.

The diagram below is an application that contains a three-layer embodiment: A Web project, one or more class libraries, and so on. I've added the data Access Layer (Layer,dal) and the Business Logic layer (Business Logic LAYER,BLL) to this solution.



Next, you can set up the references between projects and the dependency management of the compilation, for example, the above example dependencies are as follows:


This BLL layer is based on the Dal, and the http://localhost:81/is based on BLL, which determines the order in which the system is compiled: The DAL is compiled first, then the BLL is compiled http://localhost:81 This web project.

I can then directly save my solution, this workaround encapsulates all of the projects (including cross-references and dependencies between projects), and in this context it is similar to the VS2003, where I just open the solution and the system loads all the projects and resources and files.

When I post a Web site later, it consolidates the overall results of DAL, BLL, and Web projects into binary files, so when I publish a Web site, you don't need dal and BLL projects.

(on the above Dal, BLL and other specific practical applications you can refer to the ASP. NET technical explanation and application example of the last chapter)



Use asp.net2.0 version

Finally, the asp.net version of the problem. Just as the visual stuido.net2003 and the. NET Framework V1.1 fit well, the Visual Studio.NET 2005 and the. NET Framework V2.0 are also well coordinated. This means that VS2003 and VS2005 can be installed on the same machine. The original project you can still use VS2003 continue to develop, and new projects you can choose to use VS2005 for development.

This also means that you can choose the version of your ASP.net application running on the Web server, you can let some applications run on the asp.net1.1 version, some run in the asp.net2.0 version. In other words, you can decide for yourself. NET run version control.

By default if you have previously installed the asp.net1.1 version on your machine and then installed asp.net2.0, you will not normally consider changing the application immediately and upgrading to the latest version, instead you may want to decide on your own version of the application, officially for this reason, so when you install asp.net2.0, The system does not change your default settings and still uses the asp.net1.1 version.

In order to achieve. NET version control, the system is implemented by using the newly added "ASP.net" tab of IIS, ASP. NET page labels are added automatically when we install the. NET2.0 version. In the root of the property force, you can set the default global application version of the following figure, in addition to the page tags are automatically added to any one of the application properties, this page allows us to set the use of each individual application version.

Here we need to emphasize the "cascading" nature, previously described as an example, if I set APP2 to use. NET 2.0, then APP3 if it is. NET1.1 version, then remain unchanged, because APP2 and app3 are tied;

However, if I set the APP3 to. NET2.0, because the APP4 default bundle belongs to App3, if the original App4 is a. NET1.1 version, it is updated to the. NET2.0 version.

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.