![]() |
Web Development »
ASP.NET »
Howto
Intermediate
License: The Code Project Open License (CPOL)
Deployment of a Website on IISBy BrijThis article tries to dig into IIS and explore it. |
.NET (.NET 2.0, .NET 3.0), ASP.NET, IIS, Ajax, Dev
|
||||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
During last few days, I was deploying my application and I faced a lot of issues. I found deploying an application properly is as much as important as developing application. If application is not deployed properly, it can be very harmful to you application Here I want to share my learning to you all.
For deployment, first we need to understand IIS, it's request processing and then we'll go for deployment of the website and various configuration available in IIS, their key features, advantages and disadvantages etc..
IIS at root level, a Windows Service that is responsible for processing requests received on specific ports. For it, a service called the World Wide Web Publishing Service runs on the system. For deploying an application, we cerate a Virtual directory and the convert it into an application. Actually Virtual Directory is nothing more than a configuration entry in IIS for sharing a physical path for access through Web Server.
The complete configuration (with all its settings) is stored in a file, called a metabase, on local system. IIS metabase is a XML -based data store in IIS6.x and it can be configured through IIS management console.
Normally ,Web application are accessed and processed through browser. Browser sends the request to the Server (Here it is IIS) which actually process the request. The following are the steps that are done by IIS
The web server is now split into several components.IIS 6.0 includes a kernel mode driver called HTTP.SYS,which is responsible for receiving HTTP requests from clients. And the kernel forword the requests to any process that registers itself to specific URLs.
All the reliability and security options are configured at the applications pool level.Therefore,when running ASP.NET on IIS6.0,the classic ASP.NET process model with the configuration of the <processModel> element in the machine.config is desabled ,cause all the options introduced for the <processModel> are configured for IIS6.0 worker process.
WAS monitors each workers process and if one fails it restarts it so that it application doesn't go down abruptly.

Managing a virtual directory includes creating a virtual directory and its all settings. When IIS is installed a directory named "c:/Inetpub/wwwroot" is created automatically.Any files in this directory will appear as they're in the root of the web server.using the wwwroot directory fro creating a virtual directory makes a very poor organisation so try to avoid it.That's why I coosen the second option as below

2. Click next.Set alias of your website as you want

3. Click Next and browse the physical path of your application.

4. Set Permissions as we have five options as

5. Right Click on the Virtual Directory and go to properties and clock on create to set it as application

IIS made very easy to configure Virtual directory settings after creation of it. Just Right click on virtual directory and choose properties. And the property window will appear. Below I am trying to explore some most important settings.
File Mappings: As earlier, IIS forwards requests for aspx pages to the ASP ISAPI extension and sends requests for ASP.NET pages to the ASP.NET ISAPI extensions. And IIS decides the ISAPI extension based on the filename extension of the requested URL and these mappings can be done per virtual directory basis. To view it, click Configuration button on the Virtual Directory tab in the properties of a Virtual Directory.
| S No | File Extensions | Description |
| 1 | .aspx | These are ASP.NET WebPages |
| 2 | .ascx | These are ASP.NET user controls. It can't be accessed directly, to access it it must be hosted on ASP.net pages. |
| 3 | .asmx | These are ASP.NET web services, which is used for exposing functionality to other applications over HTTP. |
| 4 | .asax | These are for Glo9bal application file which is used for global events like when user starts the application. |
| 5 | .ashx | These are HTTPHandlers,which allow to process requests without using the full-fledged ASP.NET web-page model. |
| 6 | .axd | These are used for the trace.axd application extension, which allows to trace messages while debugging |
| 7 | .rem and .soap | These extn identify that IIS is hosting an object that can be called by .NET Remoting |
| 8 | .cs,.csproj,.licx,.config,.resx,.webinfo | These files are used by ASP.NET, but that can't be directly called by clientsAlthow,ASP.NET registers them so that it can explicitly prevent users from accessing these files, regardless of the IIS security settings. |
Normally, if we have multiple versions of ASP.NET installed at one point of time, one may want to configure the mappings deffrently in different directories.
Documents: This tab allows one to specify the default documents for a Virtual Directory. Like if user just type "http://MyServer/MyApplication" then IIS simply redirect to the user to that default page. If none page is found, IIS will return the HTTP 404 (page not found error). To see and set the default page, in the properties of the Virtual Directories, Click on the documents tab

Custom Errors: This tab allows us to specify an error page that'll be displayed for specific type of HTTP errors (see below picture) .One can use ASP.NET configuration to replace HTTP errors or application errors with custom messages. This only work if the web request makes it to ASP.NET service.

As a default installation, one application pool called DefaultAppPool is created. This runs as a Network Service, every web application runs on default website uses this default pool.
First let us try to know, when we need different application pool as we have already an application pool as DefaultAppPool .Mainly there are three reasons
Note: Recycling an application pool (worker process) means stoppinng the old worker proceses which have already take lots of resources and start new instance of it for the application pool.
To create the application pool follow the below steps ( Please keep in mind that IIS should be installed on the machine)

2.

3.

Here you have two options
4. You can configure the application pool by right click on the pool created and select properties

5. You can configure the identity of every application pool by selecting Identity tab from the property window of application pool as above window

Here in the dropdown ,one has three options:
Network Service: This account is restricted account with least privileges in the three.This is mainly used for applications that require access to network and need to be accessed from other machines in the network.
Local Service: This account is having more restricted than Network service and mainly to be used for services that don,t require additional network access.
Local system: Generally this account is not recommended to use, because it is most powerful account of the system. It can perform any action on the local system. so the basic motto , one should provide that much of privilege that the application needed so it can't be hacked easily.
you can also configure it as selecting your own user account by specifying the the Windows user name and password for this account.

change the application pool and click on apply button.
Deploying is nothing more than copying the published code of the application to target machine and configure the environment as needed. this is true for simple application but for application using database or access other resources, one need to perform additional steps.
Hope you all like this article. Please do post your comments it'll help me a lot to improve this article as well as my upcoming articles.
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 3 Jan 2009 Editor: Sean Ewington |
Copyright 2009 by Brij Everything else Copyright © CodeProject, 1999-2009 Web19 | Advertise on the Code Project |