Monday, September 12, 2011

Running a WebSite using IIS Express from the Command prompt and Visual Studio Integration

Open a command prompt.

You do not need administrator rights to users to execute commands in this tutorial. However, you must have administrator rights user to run IIS Express ports numbered 1024 or less.
    Run the following command to go to the IIS installation folder Express:

    cd \ Program Files \ IIS express

    or if you are using a 64-bit operating system, run the following command:

    cd \ Program Files (x86) \ IIS express
    Run the following command to see the chain of explicit use IIS:

    iisexpress /?

Express use IIS:
    iisexpress [/ config: config-file] [/ site: site-name] [/ siteid: site-id] [/ system tray: boolean]
    iisexpress / path: Application path [/ port: port-number] [/ clr: clr-version] [/ system tray: boolean]

   / Config: config-file
The full path to ApplicationHost.config. The default is the IISExpress8 \ Config \ ApplicationHost.config found in the user's My Documents folder.

  / Site: site-name
    The name of the launch site, as described in the file ApplicationHost.config.

    / Siteid: Site Identification
    The ID of the launch site, as described in the file ApplicationHost.config.
   / Path: implementation of the route
    The full path of physics application to run. You can not combine this option with the / config and the like.

 / Port: Serial Port
    The port that the application be attached. The default is 8080. You must also specify the / path.

  / Clr:. Clr-version of NET Framework (eg, v2.0) to use to run the application. The default is v4.0. You must also specify the / path.

 / System Tray: boolean
    Enables or disables the use of the system tray. The default is true.

    / Trace: trace level debugging
    Valid values
​​are information oi, ow warning, error or e.
    iisexpress / site: WebSite1
    This command runs WebSite1 site configuration file from the user profile.

    iisexpress / config: c: \ myconfig \ applicationhost.config
    This command runs the first site in the configuration file specified.

    iisexpress / path: c: \ myapp \ / port: 80
    This command runs the site in the folder c: \ myapp port 80.
    Run your site using one of the following:
        Use / config to run a site of a configuration file.

        See "Running your site from a configuration file" for more information.
        Use / path to run a site from the application folder.

        See "Running your website into the application" for more information.

    Note: The / path and the / config can not be combined.
    Once your site is running, you can use the IIS system tray express its management. For more information, see Using the Windows system tray to manage web sites and applications. Alternatively, you can disable the system tray by running the following:

    / System Tray: false

Running your site from a configuration file

IIS IIS Express and use the ApplicationHost.config file, which specifies the global configuration of sites, groups of applications, drivers, etc. Express IIS uses a default value, user-specific files to allow multiple ApplicationHost.config users share the same configuration computer without interfering with other users. This file is located in the% userprofile% \ Documents \ IISExpress \ Config or% userprofile% \ My Documents \ IISExpress \ config folder, depending on your operating system. When you run a site configuration file, you can specify the site running.

You can use the following commands:

    WebSite1 To run the website in the default configuration file, run:

    iisexpress / site: WebSite1
    To run the first website in the default configuration file, run:

    To run the first website in a custom configuration file, run:

    iisexpress / config: c: \ myconfig \ applicationhost.config
    To run a site called My Blog of a custom configuration file, run:

    iisexpress / config: c: \ myconfig \ applicationhost.config / site: MyBlog

Note: the / config specifies the full path to the configuration file. You can skip this option if you want to use the default configuration file. The / site specifies a particular site in the configuration file. You can skip this option to run the first site in the configuration file.
Running your website into the application

You can also use the / path to run a site directly from a folder. This option works for any application, including static HTML, ASP.NET, PHP, and WCF. By default, IIS Express to run the site at http://localhost:8080/. A website manager, such as ASP.NET, IIS Express use. NET 4.0. You can use the port / and / clr options to replace the default values.

For example, the following command runs the specified application "frontend" in http://localhost:9090/ using NET 2.0.:

iisexpress / path: c: \ myapp \ / port: 9090 / clr: v2.0
iisexpress / path: c: \ myapp \ / port: 9090 / clr: v2.0

 Integration with Visual Studio

IS Web Server for particular website:
IIS is the other option developers use when running and testing their applications with Visual Studio.  You can configure a web project within Visual Studio to use IIS by right-clicking on the project and pulling up its properties (and then by clicking on the “Web” tab within the properties window)":
Using IIS as your development server allows you to take full advantage of all web-server features (SSL, URL Rewrite Rules, etc).  IIS is a full-fledged web-server – which means you’ll get an experience closer to what it will work like when you deploy the application on a production server.
The downside with using the IIS option today, though, is that some companies don’t allow full web-servers to be installed on developer machines. IIS also requires administrator account access to setup and debug projects.  Different versions of Windows also support different versions of IIS.  For example, if you are running on Windows XP you have to use the IIS 5.1 web-server that comes with it – which doesn’t support all the new features of IIS 7.x.  Configuring a web project within VS to use IIS also requires some extra installation and configuration steps.

The VS 2010 Sp1, by itself, includes only the tooling in VS to support using IIS Express as the development server. So after installing Sp1, you will see that a new checkbox exists under Tools > Options > Projects and Solutions > Web Projects to use IIS Express for new websites and web projects, but this checkbox is disabled (see figure 1 below).

Figure 1 – IIS Express needs to be installed for Sp1 tooling to light-up

Use IIS Express in Tools-Options

No comments :

Post a Comment