Search This Blog

Thursday, November 19, 2015

Interview Preparation Questions

What is the difference between 32 and 64 bit operating system?
A 32 bit processor is faster than a 64 bit processor, 64 bit processors are very commonly used that you can find it easily in any home pc but the main difference is the hardware you are having on your machine. For 32 bits there isn't any need of any wide main bus to carry 32 bits at a time but for 64 bits its must that you should have a wider bus to carry 64bits. The main difference between a 32 bit and 64 is that 32 bit system has 4gb(gigabytes) of space for addressing means that the 32 bit system has a limit of 4GB RAM to process data where as the 64 bit operating system has 2^64 bits of space to address and supports 16 hexabytes of RAM to process data.
In simple words an operating system of 32 bit has a 4GB limit to process any data depending upon the sizes of files and RAM. A person who does not care about the category will find 64 bit more beneficial than 32 bit because he can use 64 bit OS with 32 bit OS and software. If we compare 64 bit with 32 bit OS, 64 bit is faster and performs more upgraded silicon processes and have more no of transistors which proves it to be more advantageous than 32 bit.
Now most of the software companies are developing their software in accordance to the 64 bit environment, it's really hard for the consumers to run a 64 bit application in 32 bit environment, in this case they have to upgrade their hardware's such as RAM which is also a big issue because most of the computer users have less than 1Gb in their systems. So instead of changing your hardware often I would recommend 32 bit OS over 64 bit which is more user friendly and enables its user to run applications of 64 bit in 32 bit environment.
IIS Differences:
IIS 4.0
IIS 5.0
IIS 5.1
IIS 6.0
Platform
NT4
Windows 2000
Windows XP Professional
Windows Server 2003 family
Architecture
32-bit
32-bit
32-bit and 64-bit
32-bit and 64-bit
Application process model
TCP/IP kernel
MTX.exe
TCP/IP kernel
DLLhost.exe (multiple DLL hosts in medium or high application isolation)
TCP/IP kernel
DLLhost.exe (multiple DLL hosts in medium or high application isolation)
HTTP.sys kernel
When IIS is running in IIS 5.0 isolation mode: Inetinfo.exe (in-proc processes) or DLLhost.exe (out-of-proc processes)
When IIS is running in worker process isolation mode: W3Wp.exe (multiple worker processes)
For more information on IIS isolation modes, see "Configuring Isolation Modes" in IIS Help, which is accessible from IIS Manager.
Metabase config
Binary
Binary
Binary
XML
Security
Windows authentication SSL
Windows authentication
SSL
Kerberos
Windows authentication
SSL
Kerberos
Security wizard
Windows authentication
SSL
Kerberos
Security wizard
Passport support
Remote administration
HTMLA
HTMLA
No HTMLA
Terminal Services
Remote Administration Tool (HTML)
Web Server Appliance Kit (SAK).
Terminal Services
Cluster support
In Windows NT 4.0
IIS clustering
Windows support
Windows support
WWW services
IIS on NT 4.0
Personal Web Manager on Windows 9x
IIS on Windows 2000
IIS optionally on Windows XP Professional
IIS on a member of the Windows Server 2003 family

Microsoft SQL Database Clustering and Load Balancing

SQL Server 2000 doesn’t support out-of-the-box solutions for load balancing. As far as I have seen SQL Server 2005 does not either. There are several resources that explain the options for a sort of load balancing for SQL server. However, all of the built-in SQL solutions do not provide real database load balancing. The built-in options are really designed to keep a cold standby copy of the data in a read only database, or updating a read only reporting SQL server in ‘near real-time’.
There is a technique to “load balance” a SQL database by using “Federated Databases” in which a DBA manually splits the tables in a database between multiple servers and then creates Views for applications to access the data.

Another option to “load balance” a SQL server database, is by using a 3rd party application to manage/maintain a “read/write” database on two servers. There is a bit of information on this below and in the references found at the bottom of this entry. One thing to keep in mind is, if you plan to implement any of these solutions, make sure the application you want to use with these SQL database load balancing option, supports it! Not all of them will. For example, a Microsoft SharePoint portal does not support this type of load balancing.

Microsoft Clustering Services (MSCS) Microsoft Cluster Service (MSCS) does not do anything to help performance or scalability. Despite its misleading name, it does not enable you to scale out or distribute traffic. Instead, if one server fails, MSCS will fail over to a backup server, which will resume processing

Federated Database Design SQL Server Enterprise Edition comes with a feature called Distributed Partitioned Views (DPV), which enables you to create a federated database, to divide processing of queries between multiple separate database servers. With DPV, the database is partitioned into many member tables, storing each of those tables on separate database servers, and then creating a partitioned view over the set of member tables.

Continuous Replication The power in this approach is that it is relatively easy to configure, and it allows you a quick solution to load balance your database read access. The obvious drawback of this approach is that it does not use live data. It must be acceptable for clients accessing this database to use slightly delayed data.

Database Load Balancing Load balancing web servers and application servers is easy and straightforward because there’s no data to persist. You can not use traditional load balancing for database servers, because the databases would get out of sync as soon as a write is made to one of them. This kind of guaranteed synchronization can only be provided when load balancing is built into the database itself, as is done with Oracle’s 9i Real Application Cluster, or provided through a middleware transaction server, such as Database Scattering.

ASP.NET

1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

2. What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.

3. What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

4. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

5. What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

6. Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture

7. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

8. What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");

10. What data types do the RangeValidator control support?
Integer, String, and Date.

11. Explain the differences between Server-side and Client-side code?
Server-side code executes on the server. Client-side code executes in the client's browser.

12. What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

13. Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasible to provide a richer, more responsive experience for the user.

14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
• A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
• A DataSet is designed to work without any continuing connection to the original data source.
• Data in a DataSet is bulk-loaded, rather than being loaded on demand.
• There's no concept of cursor types in a DataSet.
• DataSets have no current record pointer You can use For Each loops to move through the data.
• You can store many edits in a DataSet, and write them to the original data source in a single operation.
• Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

16. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

17. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.

18. Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

19. Whats an assembly?
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

20. Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

21. Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

22. Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

24. Can you edit data in the Repeater control?
No, it just reads the information from its data source.

25. Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.

26. How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.

27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.

28. What base class do all Web Forms inherit from?
The Page class.

29. Name two properties common in every validation control?
ControlToValidate property and Text property.

30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.

31. Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.

32. How many classes can a single .NET DLL contain?
It can contain many classes.

Web Service Questions
1. What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.

2. True or False: A Web service can only be written in .NET?
False

3. What does WSDL stand for?
Web Services Description Language.

4. Where on the Internet would you look for Web services?
http://www.uddi.org

5. True or False: To test a Web service you must create a Windows application or Web application to consume this service?
False, the web service comes with a test page and it provides HTTP-GET method to test.

State Management Questions
1. What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.

2. What is the lifespan for items stored in ViewState?
Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

3. What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

4. What are the different types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.


is there any limit for query string? if means what... 255

How to create a package for web application with components that shared with other applications?
Create a setup project which produces a .msi file.
A shared component assembly must be given a strong name using the following steps:
1. Create a key pair using sn.exe -k on the command line
2. Add AssemblyKeyFileAttribute to the assembly file and set it to the full name and path of the key file generated in step 1.
3. Build the assembly
The setup program detects a strong named assembly and installs it into GAC on the client machine.
what is .net frame work?
________________________________________
.Net framework is an environment provided on top of the OS which looks into
1. Memory management
2. Thread management
and provides
1. Language independence
2. Platform independence
It is defined by Microsoft as 'an environment for building, deploying and running web services and other applications. It consists of three main parts -- CLR, framework classes and ASP.Net'
.Net facilitates integration of code written for desktop applications with code written for web applications. It also facilitates creation of assemblies from code files written in different .net languages. It provides a common type system (CTS) for bringing data types of all languages on a common platform.

What do you mean by authentication and authorization
________________________________________
Simple answer to this is as follows Authentication is process of finding whether the user is valid.Example username and password u enter in mail page.That process is authentication Authorization is the process of holding rights for particular task.Example: Usually admin have right to install software in companies and others are not granted this right.

What is difference between Authentication and Authorization?
________________________________________
Authentication-->Checking the validity.Ex:A creditcard validation by Verisign.It is called authenticating the CreditCard

Authorization-->Giving some rights -Ex:I authorize mr.Rahul to sign some papers realted with my bank accounts

You are logged on to a client. You do not have a secure connection from your client to the host
where your Oracle database is running. Which authentication mechanism allows you to connect to the database
using the SYSDBA privilege?
A. Control file authentication
B. Password file authentication
C. Data dictionary authentication
D. Operating system authentication

Answer: B
What is the default authentication mode for IIS
Ans:
A) Windows
Explain Assemblies?,Difference between Panel and GroupBox?,Differences between ASP and ASP.NET
Assemblies are single deployable unit which consist of classes structures and interface.they consist of metadata which desrcibes assembly version ,name ,type etc. They are known as logical DLL's .
panel are scrollable and in panels captions can not be displayed.
it is vice versa incase of group box

Asp is not compiled that is interperated where as ASP.net is compiled.

ASSEMBLIES

Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

Hi All,
I found that there are numerous posts for Assemblies but none for giving out the difference between Panel and a Group Box. Although a Panel as well as the groupbox are almost the same there are minute differences.
In group box you can enter text while you cant do that in Panel.
In Panel you have got a built in support for scrollbars which is not available in case of group box.
What is the difference between excute query and excute nonquery.?
Execute Query is the method which is used to return the result of the command like select Query. That is Update Query. The Execute Non Query
is used to return the Query os the statement like the update Delete Insert which returns No data
What is the Subquery ?

Sub query is a query whose return values are used in filtering conditions of the main query.

What is the maximum number of cookies that can be allowed to a web site
20


Whats the use of @ Register directives ?
@ Register
Associates aliases with namespaces and class names for concise notation in custom server control syntax.
<%@ Register tagprefix="tagprefix" Namespace="namespace" Assembly="assembly" %><%@ Register tagprefix="tagprefix" Tagname="tagname" Src="pathname" %>
Attributes
tagprefix
An alias to associate with a namespace.
tagname
An alias to associate with a class.
Namespace
The namespace to associate with tagprefix.
Src
The location (relative or absolute) of the declarative User Control file to associate with the tagprefix:tagname pair.
Assembly
The assembly in which the namespace that you are associating with tagprefix resides.
Note The assembly name does not include a file name extension.

In DataGrid, is it possible to add rows one by one at runtime. That means after entering data in one row next row will be added.

Yes, for this you have to use datatable and after inserting the first row in datatable u have to bind that datatable to the grid and next time , first u have to add the row in datatable and next bind it to datagrid. keep on doing.
u have to maintain the datatable state


Troubleshooting IIS Access Problems

Spending countless hours developing a Web site only to discover that no one can access it is frustrating. This article guides you through the process of troubleshooting Web-site access problems.
Possible Causes of Failed Access
Some of the more common causes of access troubles include broken network links, incorrect firewall settings, and IIS permission problems. The general networking-type problems tend to be easy to figure out. For example, if no traffic is able to flow in or out of your network, then there's a good chance that there's a broken network link somewhere. Likewise, if inbound traffic is flowing, but no one can access your Web site, some simple port sniffing can tell you if TCP port 80 is blocked on your firewall.
Depending on the responses that I receive to this article, I may write a full-fledged article on connection troubleshooting in the future. For now though, I'll focus this article on IIS access problems that are related to permission problems.
Setting Up the Security Log
The first step in troubleshooting IIS connection problems is to have a clear understanding of what's really going on. A big part of doing so involves reading your event logs. However, without some tweaking on your part, the event logs may not display information that is helpful to you.
Since we're talking about IIS access problems that are related to permissions, we'll be working predominantly with the Security Log. Reconfiguring the Security Log involves telling IIS which information to log, stopping the IIS services, clearing any existing Security Log entries, and finally, restarting the IIS services. In case you're wondering, the reason for stopping the IIS services is because sometimes IIS caches security log information. Unless you stop and restart the services, it's possible for cached security information to show up in the Security Log even after you've cleared the existing log contents. Obviously this cached information can be misleading since it appears to be current. Therefore, I strongly recommend stopping and restarting the IIS services as a part of the Security Log configuration process.
Begin the configuration process by selecting the Computer Management command from the Programs | Administrative Tools menu. Next, navigate through the Computer Management console tree to Services and Applications | Internet Information Services. Expand the Internet Information Services container to reveal the Web sites beneath it. Right click on the Web site that you're having trouble with and select the Properties command from the resulting context menu. When you do, you'll see the Web site's properties sheet. Now, select the properties sheet's Web Site tab and select the Enable Logging check box. When you do, you'll have a choice of various log file formats. I recommend using the W3C Extended Log File Format. Click the Properties button to reveal the Extended Logging Properties sheet.
By default, the properties sheet's General Properties tab will be selected. This tab allows you to control how often a new log file will be created. How often you build a new log file is really a matter of personal preference, so whatever you want to choose is fine. More important is the Extended Properties tab. This tab allows you to select which pieces of information will be included in your log file entries. You may select whichever elements you want, but at a minimum the log entries should include the following elements:
Date, Time, Client IP Address, User Name, Method, HTTP Status, and Win32 Status.
When you've made your selections, click OK twice to return to the main Computer Management console screen.
Now that you've configured the Web site's logging options, it's time to clear the cache and clear any existing log entries. The first step in doing so is to stop the various IIS services. To do so, open a Command Prompt window by selecting the Command Prompt command from the Programs | Accessories menu. Next, enter the following command:

NET STOP IISADMIN /Y

This single command will stop all of the IIS services. Once the services have stopped, leave the Command Prompt window open and open the Event Viewer by selecting the Event Viewer command from the Programs | Administrative tools menu. When the Event Viewer opens, right click on the Security Log and select the Clear All Events command from the resulting context menu. Now, that you've cleared the cache and the Security Log, it's time to restart IIS. Return to the Command Prompt window and enter the following commands:

NET START W3SVC
NET START MSFTPSVC
NET START NNTPSVC
NET START SMTPSVC

Keep in mind that not all of these commands will apply to all servers. For example, if you aren't running the FTP service, then you can ignore the command that deals with FTP.
Checking the Security Log
Now that you've configured the Security Log, it's time to begin creating some log entries. To do so, try to access the Web site that's having problems. I recommend attempting to access the Web site from both inside and outside of the organization, and from a variety of computers, if possible. Doing so should give you some very useful log entries that you can compare against each other to determine the true nature of the problem. For example, you may discover that the Web site works correctly when accessed from inside the organization, but not when accessed from the outside. Another possibility is that the site may work fine for authenticated users, but not for anonymous users.
As you compile Security Log entries, the first thing that I recommend doing is scanning the log entries for 401 and 403 errors. There are a variety of 401 and 403 error codes, but knowing the exact error codes that are being generated can provide you with some excellent clues about the cause of the problem. Below I've listed the various 401 and 403 error codes and what these codes mean:

401;1                    Unauthorized access because the logon has failed
401;2                    Unauthorized access because the logon has failed due to the server
configuration
401;3                    Unauthorized access because of an Access Control List (ACL) entry
401;4                    Unauthorized access because an IIS filter is blocking access
401;5                    Unauthorized access because of an ISAPI or CGI application
403;1                    Forbidden because execute access isn't allowed
403;2                    Forbidden because read access isn't allowed
403;3                    Forbidden because write access isn't allowed
403;4                    Forbidden because SSL use is required
403;5                    Forbidden because 128-bit SSL use is required
403;6                    Forbidden because the IP address was rejected
403;7                    Forbidden because a client certificate is required
403;8                    Forbidden because access to the site is denied
403;9                    Forbidden because too many users are presently attached to the site
403;10                 Forbidden because of an invalid configuration
403;11                 Forbidden because of an invalid password
403;12                 Forbidden because the Web site requires a valid client certificate
403;13                 Forbidden because the client certificate was revoked
403;14                 Forbidden because the directory listing is denied
403;15                 Forbidden because the client access license count was exceeded
403;16                 Forbidden because the client access certificate is invalid or untrusted
403;17                 Forbidden because the client access certificate is expired or is not yet valid

With luck, checking your Security Log for 401 and 403 errors and comparing any errors that you might find against my list of error codes has helped you to narrow down the cause of your problems. If you still need some help, however, check out the sections below. They deal with specific types of permissions issues and how to fix them.
Other Possible Causes of Connection Failure
The Error Isn't Always Where You Think
If you've been unable to resolve your permissions problem so far, then perhaps your error may not be occurring where IIS says it is. This is especially true when dealing with ASP environments that use the <!-- #include --!> command.
For example, suppose that you were getting an access denied error on the DEFAULT.ASP file. There's a possibility that you may very well have permissions to access DEFAULT.ASP, but not one of the other ASP files that is included with it. For example, if DEFAULT.ASP had instructions to include TOOLS.ASP, and TOOLS.ASP had some sort of ACL block on it, then you could very well get an access denied message when accessing DEFAULT.ASP. DEFAULT.ASP is fine, but one of the required subcomponents isn't. Because IIS isn't calling that subcomponent directly, it reports the error when accessing the page that called it, in this case DEFAULT.ASP.
Fortunately, it's relatively easy to tell if a subcomponent is causing your access woes. Just comment out any Include statements. If your problem goes away, then you know that one of the Include commands was causing the problem. Next, re-enable one Include command at a time, testing the Web site between each one. By doing so, you can quickly narrow down which command is causing your problems.
Check Your Account
Another troubleshooting technique would be to look at the entries in the Security Log and see which account is being used to access the site. For some reason, maybe an unintended account is in use. If this is the case, then it explains right away why access is being denied. Even if the account that's listed in the Security Log is the intended account, the log still gives you solid evidence of which account is in use. This means that you can check the account's ACL with confidence, knowing that you are on track.
When checking an account's permissions, there are some specific things to look for. For example, the account must have NTFS-level access to the directory that contains the Web site and all of the directories beneath it. Likewise, you should also check to see if the account has Log On Locally or Network Logon permissions.
Unexpected Errors
Occasionally, there may be a situation where users are expected to need only read access to a Web site, but you receive error messages indicating that a user doesn't have the necessary write or delete permissions. Typically, if these types of unexpected errors occur on a new Web site, it doesn't mean that you have an attempted security breach. Instead, it often means that some subcomponent of the Web page requires write or delete access. An example of such a subcomponent might be a hit counter.
Anonymous Authentication
The vast majority of Web sites use anonymous authentication. This means that the user isn't required to enter a user name and password. However, for the sake of security, authentication is still occurring; it's just hidden from the user. Anonymous authentication works by using a designated user account's permissions to access the Web site. Any time that you use anonymous authentication, the designated user account must exist, have a valid password, and must not have expired or have been deleted. All of the other standard security mechanisms also apply, such as the account's ACL or designated logon hours.
You can see which account is being used for anonymous authentication by right clicking on the virtual server in the Computer Management console and selecting the Properties command from the resulting context menu.. When the site's properties sheet appears, select the Directory Security tab and click the Edit button found in the tab's Anonymous Access and Authentication Control section. When you do, the Authentication Methods dialog box will appear. Make sure that the Anonymous Access check box is selected, and then click the Edit button to verify which account is being used.

Introduction
In IIS 7, you can create sites, applications, and virtual directories to share information with users over the Internet, an intranet, or an extranet. Although these concepts existed in earlier versions of IIS, several changes in IIS 7 affect the definition and functionality of these concepts. Most importantly, sites, applications, and virtual directories now work together in a hierarchical relationship as the basic building blocks for hosting online content and providing online services.
This article provides a quick overview of applications in IIS 6.0 so that you can better understand the differences introduced in IIS 7. It then explains the concepts of sites, applications, and virtual directories in IIS 7 and introduces the <sites> section in configuration.
This article contains:
About Sites, Applications, and Virtual Directories in IIS 6.0
In IIS 6.0, the concepts of virtual directories and applications were confusing. Although they were discussed as separate concepts, (and they were conceptually different from a functionality standpoint), an application was not a physically separate object from a virtual directory. In IIS 6.0, an application was really just a virtual directory with one or a combination of the following properties in the metabase: AppFriendlyName, AppRoot, AppIsolated, and AppPoolID.
Note: The site root is an exception, as it was implicitly treated as an application even if those properties were not set.
Applications were less important to IIS than to the technologies that extended Web server functionality, such as Active Server Pages (ASP), Internet Server Application Programming Interface (ISAPI), and ASP.NET. These technologies provided additional features and processing for applications hosted in IIS 6.0, and enabled developers to create more complex applications. The important question for IIS 6.0 was isolating such applications in a way that would prevent applications in one application pool from affecting applications in another application pool on the server.
About Sites, Applications, and Virtual Directories in IIS 7
IIS 7 formalizes the concepts of sites, applications, and virtual directories. Virtual directories and applications are now separate objects, and they exist in a hierarchical relationship in the IIS 7 configuration schema. Briefly, a site contains one or more applications, an application contains one or more virtual directories, and a virtual directory maps to a physical directory on a computer.
As in IIS 6.0, a site contains all the content, both static and dynamic, that is associated with that site. However, each site must contain at least one application, which is named the root application. And each application (including the root application) must contain at least one virtual directory, which is named the root virtual directory. These objects work together to form the site.
Additionally, in IIS 7 the concept of an application now has meaning to both IIS and the technologies that extend IIS functionality. An application is an object important to the server at runtime. This is because the IIS and ASP.NET request-processing pipelines have merged in IIS 7 so that content can take advantage of functionality previously provided for only managed code applications. For example, each managed code application runs in an Application Domain (AppDomain). An application can have several virtual directories, and each one will be served by the same AppDomain as the application to which they belong.
The following sections explain sites, applications, virtual directories, and their related configurations in more detail.
Sites
A site is a container for applications and virtual directories, and you can access it through one or more unique bindings.
The binding includes two attributes important for communication: the binding protocol and the binding information. The binding protocol defines the protocol over which communication between the server and client occurs. The binding information defines the information that is used to access the site. For example, the binding protocol of a Web site can be either HTTP or HTTPS, and the binding information is the combination of IP address, port, and optional host header.
A site may contain more than one binding if the site requires different protocols or binding information. In earlier versions of IIS, only the HTTP and HTTPS protocols were supported. For example, a Web site might have had both an HTTP binding and an HTTPS binding when sections of the site required secure communication over HTTPS.
In IIS 7, bindings can apply to any protocol. The Windows Process Activation Service (WAS) is the new service that makes it possible for IIS 7 to use additional protocols. This service retains the familiar IIS 6.0 process model, such as application pools and message-based process activation, as well as hosting features, such as rapid failure protection, health monitoring, and recycling. However, WAS removes the dependency on HTTP from the activation architecture. This is useful for technologies that provide application-to-application communication in Web Services over standard protocols. The Windows Communication Foundation (WCF) programming model is one such technology that can enable communication over the standard protocols of Transmission Control Protocol (TCP), Microsoft Message Queuing (MSMQ), and Named Pipes. This lets applications that use communication protocols take advantage of IIS features, such as process recycling, rapid fail protection, and configuration that were previously only available to HTTP-based applications. For more information about the WCF programming model, see Windows Communication Foundation on MSDN.
In addition to containing applications (which contain virtual directories) and specifying bindings, the following configuration settings belong to the site:
  • Limits: configure settings to limit the amount of bandwidth, the number of connections, or the amount of time allowed for connections to a site.
  • Logging: configure settings for handling and storage of log files for the site.
  • Failed request trace logs: configure settings for logging failed-request traces for the site. 
Applications
An application is a group of files that delivers content or provides services over protocols, such as HTTP. When you create an application in IIS, the application's path becomes part of the site's URL.
In IIS 7, each site must have an application which is named the root application, or default application. However, a site can have more than one application. For example, you might have an online commerce Web site that has several applications, such as a shopping cart application that lets users gather items during shopping and a login application that allows users to recall saved payment information when they make a purchase.
In addition to belonging to a site, an application belongs to an application pool, which isolates the application from applications in other application pools on the server. In the case of managed code applications, make sure to associate your application together with an application pool that is running the .NET Framework version that your application requires.
As described in the Sites section of this paper, IIS 7 supports HTTP and HTTPS by default, but you can use additional protocols. For each site, you specify one or more bindings to communicate with and access content in the site. For an application to communicate by using a protocol that is specified in the parent site's binding, you must enable the protocol. To do this, specify the protocol in the enabledProtocols attribute for the application, and ensure that you have the appropriate listener adapter on the server and specified in the <listenerAdapters> section in configuration.
Virtual Directories
A virtual directory is a directory name (also referred to as path) that you specify in IIS and map to a physical directory on a local or remote server. The directory name then becomes part of the application's URL, and users can request the URL from a browser to access content in the physical directory, such as a Web page or a list of additional directories and files. If you specify a different name for the virtual directory than the physical directory, it is more difficult for users to discover the actual physical file structure on your server because the URL does not map directly to the root of the site.
In IIS 7, each application must have a virtual directory, which is named the root virtual directory, and which maps the application to the physical directory that contains the application's content. However, an application can have more than one virtual directory. For example, you might use a virtual directory when you want your application to include images from another location in the file system, but you do not want to move the image files into the physical directory that is mapped to the application's root virtual directory.
By default, IIS uses configuration from Web.config files in the physical directory to which the virtual directory is mapped, as well as in any child directories in that physical directory. If you do not want to use Web.config files in child directories, specify false for the allowSubDirConfig attribute on the virtual directory.
Optionally, when you need to specify credentials and a method to access the virtual directory, you can specify values for the username, password, and logonMethod attributes.
IIS 7 Configuration: <sites> Section
Take a look at the default <sites> section in IIS 7. This is what is in the ApplicationHost.config file (located at %windir%\system32\inetsrv\config \) after installing IIS on Windows Server® 2008. 


<sites>

<site name="Default Web Site" id="1">

<application path="/">

<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />

</application>

<bindings>

<binding protocol="http" bindingInformation="*:80:" />

</bindings>

</site>

<siteDefaults>

<logFile logFormat="W3C" directory="%SystemDrive%\inetpub\logs\LogFiles" />

<traceFailedRequestsLogging directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles" />

</siteDefaults>

<applicationDefaults applicationPool="DefaultAppPool" />

<virtualDirectoryDefaults allowSubDirConfig="true" />

</sites>
  
When you see a single "/" in a path field, you know that this is a root object. Depending on whether it is in the application or virtual directory section, it is a root application or a root virtual directory.
Default Elements
The following section lists the collections and elements in the <sites> section, and their hierarchical relationship within the <sites> section.


<sites> section

<site> collection

<bindings> collection

<binding> element

<clear> element

<limits> element

<logFile> element

<traceFailedRequestsLogging> element

<application> collection

<virtualDirectory> collection

<virtualDirectoryDefaults> element

<applicationDefaults> element

<virtualDirectoryDefaults> element

<siteDefaults> element

<bindings> collection

<binding> element

<clear> element

<limits> element

<logFile> element

<traceFailedRequestsLogging> element

<applicationDefaults> element

<virtualDirectoryDefaults> element
  
Notice that there are two elements that appear in more than one place: the <applicationDefaults> element and the <virtualDirectoryDefaults> element. There is also a <siteDefaults> element, although it appears only once because it can be configured in only one location in the <sites> section. Default elements are special because they enable you to configure default values for attributes instead of having to repeat the same values in each collection.
When an attribute is configured at more than one level, the value at the lowest level is used. For example, if you specify a default value in an <applicationDefaults> element in both the <sites> section and in a <site> collection, the value from the <site> collection will be used. Additionally, if the same attribute or child element is configured in both a default element and in the object's collection, the value in the collection will be used. For example, if you configure an attribute in an <applicationDefaults> element and in an <application> collection, the value from the <application> collection will be used.
The following table specifies under which parent elements an <applicationDefaults> element can be configured, and describes the effect that the values have on applications.
Parent element
Description
<sites> section
Specifies the default settings for all applications on the server.
<site> collection
Specifies the default settings for all applications in the parent site.
The following table specifies under which parent elements a <virtualDirectoryDefaults> element can be configured, and describes the effect that the values have on virtual directories.
Parent element
Description
<sites> section
Specifies the default settings for all virtual directories on the server.
<site> collection
Specifies the default settings for all virtual directories in the parent site.
<application> collection
Specifies the default settings for all virtual directories in the parent application.
Summary
You should now have a better understanding of sites, applications, and virtual directories in IIS 7. Unlike IIS 6.0, applications and virtual directories have become distinct objects in configuration, which highlights their unique purpose to the Web server and their relationship to the site. Additionally, sites can now contain applications that use protocols other than HTTP and HTTPS, which extends site functionality while retaining the benefits of the process model introduced in IIS 6.0.
For more information about WAS and IIS 7 architecture, see IIS 7 Request-Processing Architecture on IIS.NET. For more information about the configuration settings discussed in this article, see IIS 7 Settings Schema on MSDN.

How Application Pools Work (IIS 6.0)

When you run IIS 6.0 in worker process isolation mode, you can separate different Web applications and Web sites into groups known as application pools. An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Any Web directory or virtual directory can be assigned to an application pool.
Every application within an application pool shares the same worker process. Because each worker process operates as a separate instance of the worker process executable, W3wp.exe, the worker process that services one application pool is separated from the worker process that services another. Each separate worker process provides a process boundary so that when an application is assigned to one application pool, problems in other application pools do not affect the application. This ensures that if a worker process fails, it does not affect the applications running in other application pools.
Use multiple application pools when you want to help ensure that applications and Web sites are confidential and secure. For example, an enterprise organization might place its human resources Web site and its finance Web site on the same server, but in different application pools. Likewise, an ISP that hosts Web sites and applications for competing companies might run each companies Web services on the same server, but in different application pools. Using different application pools to isolate applications helps prevent one customer from accessing, changing, or using confidential information from another customers site.
In HTTP.sys, an application pool is represented by a request queue, from which the user-mode worker processes that service an application pool collect the requests. Each pool can manage requests for one or more unique Web applications, which you assign to the application pool based on their URLs. Application pools, then, are essentially worker process configurations that service groups of namespaces.
Multiple application pools can operate at the same time. An application, as defined by its URL, can only be served by one application pool at any time. While one application pool is servicing a request, you cannot route the request to another application pool. However, you can assign applications to another application pool while the server is running.
ISAPI Filters
ISAPI Filter plug-ins for Microsoft Internet Information Server and Personal WEB Server. Simple low-cost solutions for authentication, URL substitutions, pseudo-virtual WEB sites, redirection and traffic spreading.
What is ISAPI filter
There are two major types of plug-ins for the Microsoft WEB server products - ISAPI applications and ISAPI filters. The ISAPI applications are intended to do drive a WEB site or act as engine for which the actual server side code is written (e.g. ASP is an ISAPI application). The ISAPI filters on the other hand are plug-ins that interact with the work the WEB server does and perform additional actions, alter certain data or replace some of the server's functionality. The ISAPI filters are usually independent of the nature of the WEB content and the WEB applications running on the server. Still, very often they provide features these applications expect. For example an authenitaction filter makes possible to use custom user lists over which to authenticate the visitors instead of creating a system account for each of them. This can be "a must" for certain application, yet it is not part of it and there is no matter in what kind of language it is written.

There are many ISAPI filters on the WEB and many of them (including some of our filters) implement some tricks that are of indirect help for the webmasters or for the WEB developers. The benefits of using such a filter may not be obvious. Still, such filters are always a result of experience and problems solved. For example you can find on the Internet several different filters like our Variable Parser (shortly VarParser). They do something simple - convert the parameter part of the URL to plain URL syntax. This may look like nothing, but in fact it improves the WEB site appearance in the search sites drastically. In the past the search engines just ignored the parameters and thus ignored considerable and sometimes crucial parts of the WEB sites. Today the major search engines index everything, but still they prefer the plain URL and this speeds up the indexing drastically. No need to say that almost all the local and specialized search sites continue to ignore URL with parameters and knowing that they are usually limited on resources it is unlikely to expect that many of them will change in the future. Thus, such a simple, at first look, trick may be quite useful and bring times more visitors.


The WhosOn ISAPI filter works by sending an asychronous HTTP request to the gateway to tag a visitor.
It works like this:
1. After IIS has recieved headers, and prepared headers to send back, these are sent to the ISAPI filter.  If there is no unique cookie ID here, this is generated by WhosOn.
2. When IIS has finished processing, the ISAPI filter hooks the event that logs the access, and passes this via an asychronous HTTP request to the WhosOn gateway, including the pre-generated cookie ID.
Thats all there is to it in terms of the Filter.
The filter has settings for what HTTP Alias relates to what WhosOn site, where the gateway is, etc, and what extensions should be logged.
The major advantages of the ISAPI filter over the normal server side tracking is that the ISAPI filter:
1.     Operators Asynchronously
2.     Can track any file type
3.     Can track 404 errors, 403 errors etc.
4.     Can track the exact amount of data transferred.
5.     Does not require any code changes on the site.
Disadvantages versus In-code server side tracking:
1.     There is no way to return operator status because the web request is asynchronous, the gateway does not return any data, and there are no server variables dictating whether operators are online.
2.     You can't integrate your login (I'm thinking of adding something so that a server variable can be set in the server code, and read into the ISAPI, and passed as the username instead of the cookie name.
3.     You can't change the page names.  This has a big impact when using a lot of dynamically or database generated pages.
  However, as a replacement for log file tracking, this is excellent because:
1.     It is in real-time
2.     It can easily be done on a remote server (no need for ftp-ing the files)
3.     It is not resource intensive.  Opening huge files causes large memory and CPU usage, and over a certain speed, the server cannot keep up with the operations.
4.     You can split multiple sub domains into separate sites in WhosOn, even if they are using the same site in IIS.
5.     You can log separate sites in IIS into the same site in WhosOn.
Check out the Files -> Integrated section for the ISAPI filter installer.


No comments: