Web services are used to accept requests from Web browsers and respond accordingly. To enable the web services to respond to the web server, we need to configure them. The configuration of the web service involves the following tasks.
- Creation of Virtual directory
- Defining a web application URL
- Registering the ASP.NET file mappings
In the development phase of the application, the web application is saved in a folder on a computer on which the development is performed. After the development is completed, the application needs to be deployed on the web server. When you deploy the application on the server such as IIS, user needs to create a directory on the web server. The contents of the directory must be web pages, images, user controls, and data source files of the application. The directory is called virtual directory.
A virtual directory is created such that the user does not get the direct access to the web application folder on the host computer. The security id maintained as user or client cannot manipulate the data.
It exposes the components of a web application to the remote clients and allows them to access the web application through web browsers. When the user requests for the web page in a virtual directory, the web server searches the page into the corresponding physical directory on the host computer. After locating the page, the server send it back to the client.
Configuring the Application Pools
After the creation of the virtual directory, user can configure the application pool for the application. The pool contains one or more applications and allows the user to configure the isolation levels between different web applications.
User can configure the application pools of the web application by using the IIS manager. User needs to right click the virtual directory that is created for the web application and select the properties option. The isolation level for the application can be set by selecting the option from the Application Protection drop down list.
The properties dialog box provides the following application protection options:
- Low (IIS Process): The application that are configured to run under this application protection run in the Inetinfo.exe. It hosts the IIS core processes. If the application fails, it might stop the functioning of the web server.
- Medium (Pooled): The applications are configured to run under the application protection share. If the application fails, the web server does not get affected. The other application running under the application protection share may get affected.
- High (Isolated): The applications that are configured to run under this application protection are isolated from both the Inetinfo.exe and dllhost.exe files. Hence, if the application fails it will not affect other applications or the web server.
Users can access the web application by using the address in the address bar of the web browser. The address is known as Uniform Resource Locator (URL). A URL is the location of the file on the web. It is unique for each application.
To access the application, user types the URL for the application in the address bar of the web browser. It sends the request to the web server. It searches for the application mapped to the URL and sends the back to the browser.
Consider the example of the URL as
In the preceding URL, 172.22.3.203 is the IP address of the web server and MyWebApp is the virtual directory. To access the web application through IP address, user needs to remember the address. It is difficult to remember the IP address. Instead of the IP address, the applications are accessed through the unique name as the domain name.
For example, the application can be accessed by the following URL.
http://www.facebook.com/Home/Friends.aspx. In the example, the
www.facebook.comis the domain name for the website.
3. Registering the ASP.NET File Mappings
When multiple versions of .NET framework are installed on the same computer, each version installs the ASP.NET Internet Server Application Programming Interface (ISAPI) extension. This extension version determines which version of the CLR will be used with the particular web application.
A web application is configured to use any versions of the .NET framework that is installed on the computer. To configure the web application to use a particular version, user needs to register a script map in the Internet Information Server (IIS). A script map is the path to the ASP.NET ISAPI version used by the application.
When a user requests for a particular web page, the script map for the application directs IIS to forward the requested file to the ISAPI for processing. When the user needs to work for the particular version of the framework, user needs to update the script maps so that they can direct the request for a web page to the appropriate version of the ASP.NET ISAPI.
The Internet is the best medium for accessing information on any topic of concern. The information available on the internet is contained in different web applications. To enable the users to access this information, the applications need to be installed on the web server. The process of installing the web application on the web server is known as deployment.
The basic technique of deployment is the copy of the application components to the hard drive of the web server. In this process, various complements are deployed in the un – compiled form. This type of deployment has following issues:
- The application is deployed even if it contains compilation errors
- The source code of the application is exposed
- The loading of the application is slow because compilation is done when it is accessed for the first time.
Precompiling a web application involves compilation of the source code into the DLL assemblies before deployment. The advantages of the precompilation are as follows:
- It provides fat response time because the application does not need to be compiled the first time it is accessed.
- It helps in identifying the bugs that can occur on the web page when requested
- It secures the source code of a web application from the users that access the application
To compile the website, user needs to execute the aspnet_compiler command. The sample of the command is as shown below:
aspnet_compiler –v / -p E:\MyWebSite E:\TargetWebSite
The following lists denotes some options that can be used with the tool.
- -v: It specifies the virtual path of the application to be compiled
- -p: It specifies the physical path of the application to be compiled
- -u: It specifies the exe should create a precompiled application that allows to updates of contents of the .aspx pages.
- -c: It specifies the application to be compiled should be fully rebuilt. The already compiled components are compiled again.
Deployment is the process of copying the asp.net web application from the deployment server to the server on which the application is to be executed. There are several ways in which we can deploy the application. User can deploy the application in three different ways as mentioned below:
- xCopy Deployment
- Copying a website
- Creating a Web Setup project
1. xCopy Deployment
xCopy deployment is used when user needs to drag and drop files in File Transfer Protocol, DOS Xcopy command to copy files from one location to another. A xCopy file transfer simplifies the deployment and maintenance of the Asp.NET sites as user does not need to make any registry entries. It does not require any special software on the development computer or the web server.
The steps to perform xCopy website are as mentioned below:
- Click ‘Start’, Select ‘Programs’
- Click ‘Administrative Tools’, select ‘Internet Services Manager’ option
- Select ‘Virtual Directory’, click ‘Properties’
- Navigate to the ‘Application Settings’ option, and select the ‘Application Name’ from the box, Click ‘Create’
- Open the website to be deployed and choose the website copy command
- Click connect button to display the open website dialog and choose the destination to copy website
- Click arrow buttons to copy the files from the source website to the remote website
- It is easy, simple, quick as no registry entries and no special requirements are required
- If the user has the authority for client and server deployment, the method is useful
- The deployment is done manually and hence time consuming
- It cannot be used for complex projects
- It does not provide robust installation compared to .NET deployment
- It does not register or verify the location of the assemblies
The copy website utility enables the deployment of a website quickly and easily by copying the files from the source site to the remote site. The source site is where the Visual Studio file has opened. The remote site is the site where files needs to be copied. The destination files can be any one from the following locations:
- A file – based website
- A local IIS website
- An FTP website
- A remote website
- ASPX files
- Code-behind files
- Other web files as HTML and image files
- Open a website in Microsoft Visual Studio
- Select ‘WebSite’ > ‘Copy Web Site’ option, the following window will open
- Click ‘Connect’ button. The Open Website dialog box will open
- Select the IIS option, and open the Local Information Server page from the list of options
- Open the ‘New Virtual Directory’ dialog box and create a virtual directory
- Click ‘Browse’ button and locate the folder that contains the website to be deployed
- Click ‘OK’ button and the virtual directory with the specified name will open
- Click ‘Open’ button and select the files that needs to be copied from the source website to the destination website
- Save all the file in the system
- Exit the Visual Studio application
To deploy the web applications on the server, user needs to create a web setup project. The web setup project creates an installer file that contains the application, dependent files and information about the application.
The list of advantages of web setup project are as mentioned below:
- It automatically creates virtual directories and configures the required IIS settings
- If the installation is not successful, all the contents are rolled back
- The uninstallation process is easy for the user
- Open the website for which user needs to create the setup project
- Select the application folder in the Solution Explorer window
- Select Build > Build Web Site option
- Select File > Add > New Project option. The Add New Project dialog box will appear as shown below
- Expand the Other Project Types mode in the Project Types section. Select the ‘Setup and Deployment’ project type
- Select the ‘Setup Project’ template under the Visual Studio installed templates section
- Type the name of the web setup project in the Name text box and specify the location in the location combo box. Click ‘OK’ button
- Right Click the Web application folder, select ‘Add’ > ‘Project Output’ option.
- The ‘Add Project Output Group’ option dialog box appears as shown below:
- Select the ‘Contents Files’ option, click ‘OK’ button
- Right click the web setup project file in the Solution Explorer window. Select ‘Build’. The setup folder is created in the Application\Debug folder. Install the project by double clicking the setup file
shabbir like this