[Accumulate] use IIS Express

Source: Internet
Author: User
Tags windows support
1. Overview of IIS Express

IIS Express is a free web development server launched by Microsoft. It is small and lightweight and is especially suitable for ASP. NET developers. Before IIS Express is available, developers can only use the following two solutions:

    • ASP. NET development server that comes with Visual Studio
    • Windows IIS Web Server

Now that you have these two options, why do you want to launch IIS Express? This is determined by the shortcomings of the two solutions, as follows:

  • The Web server provided by Visual Studio does not provide complete Web server functions (for example, SSL and URL rewriting rules are not supported)
  • The Web server provided by Visual Studio does not support external access.
  • To use IIS, you need an administrator account to install and debug IIS.
  • Different versions of Windows support different versions of IIS (Windows XP cannot use the new features of iis7.x)

However, IIS express integrates the advantages of these two solutions and avoids their disadvantages.

  • First of all, in addition to no visual management interface of IIS, IIS Express is used for almost all its functions.
  • Secondly, IIS Express can also be used in Visual Studio 2010 after simple configuration (vs2012 has built-in IIS express 8)
  • In addition, IIS express supports more versions of Windows than IIS (IIS express 7.5 can be used in Windows XP)

 

2. Deploy a web application using IIS Express Program

It is very easy to deploy a site using IIS Express. You only need to modify the express applicationhost. config configuration file,This file is used to host the definition of the site, applications, application pools, and the configuration of the entire web server.The default file location is:C: \ Users \ USERNAME (username) \ Documents \ iisexpress \ configDirectory, open the configuration file. We can see that IIS express supports the following five application pools. NET 2.0 and. net 4.0 integrated and classic, and an unmanaged version:

 1                   <  Applicationpools  >  2                       <  Add  Name  = "Clr4integratedapppool"  Managedruntimeversion = "V4.0"  Managedpipelinemode  = "Integrated"  Clrconfigfile  = "% Iis_user_home % \ config \ ASPnet. config"  Autostart  = "True"   />  3                       <  Add  Name  = "Clr4classicapppool"  Managedruntimeversion  = "V4.0" Managedpipelinemode  = "Classic"  Clrconfigfile  = "% Iis_user_home % \ config \ ASPnet. config"  Autostart  = "True"   />  4                       <  Add  Name  = "Clr2integratedapppool"  Managedruntimeversion  = "V2.0"  Managedpipelinemode = "Integrated"  Clrconfigfile  = "% Iis_user_home % \ config \ ASPnet. config"  Autostart  = "True"   />               5                       <  Add  Name  = "Clr2classicapppool"  Managedruntimeversion  = "V2.0"  Managedpipelinemode  = "Classic" Clrconfigfile  = "% Iis_user_home % \ config \ ASPnet. config"  Autostart  = "True"   />               6                       <  Add  Name  = "Unmanagedclassicapppool"  Managedruntimeversion  = ""  Managedpipelinemode  = "Classic"  Autostart = "True"   /> <  Applicationpooldefaults  Managedruntimeloader  = "V4.0"  >  7                       <  Processmodel  />  8                       </  Applicationpooldefaults  >  9                   </ Applicationpools  > 

View code

Now let's look at the most important sites node. Each site node represents a site, where:The bindinginformation node consists of three parts: bound IP Address: Port: Host Name.

 1           <  Sites  >  2               <  Site  Name  = "IIS Express"  ID  = "1" Serverautostart  = "True"  >  3                   <  Application  Path  = "/"  >  4                       <  Virtualdirectory  Path  = "/"  Physicalpath  = "% Iis_sites_home % \ website1"  />  5                   </  Application  >  6                   <  Bindings  >  7                       <  Binding  Protocol  = "HTTP"  Bindinginformation  = ": 8080: localhost"   /> 8                   </  Bindings  >  9               </  Site  >  10           <  Sites  > 

Now we can start to deploy the web application and put the published web application in the specified directory (here I will put it under the webapp directory of the d disk ), then modify the configuration file above, for example, select the bound port and select the port for the Web application. NET application pool:

 1               <  Site Name  = "Website"  ID  = "2"  Serverautostart  = "True"  >  2                   <  Application  Path  = "/"  Applicationpool  = "Clr4integratedapppool"  >  3                       < Virtualdirectory  Path  = "/"  Physicalpath  = "D: \ webapp"   />  4                   </  Application  >  5                   <  Bindings  >  6                       <  Binding Protocol  = "HTTP"  Bindinginformation  = "*: 8081 :*"   />  7                   </  Bindings  >  8               </  Site  > 

Start IIS express and enter http: // localhost: 8081/in the browser to access the Web application:

 

3. Configure IIS express to enable external access

FirstThe port number used by the web application must be set in the Windows Firewall to allow access,SecondIs to modify the bindinginformation attribute of the binding node under the site node:

 
<Bindings><BindingProtocol= "HTTP"Bindinginformation= "*: 8081 :*" /></Bindings>

Finally, you need to start IIS express as an administrator and use the IP address for access:

 

References & further reading

Http://msdn.microsoft.com/zh-cn/ff844168

Http://www.cnblogs.com/nicch/archive/2011/03/20/1989192.html

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.