Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Interview Questions
Difference between "Web.config" and "Machine.Config" ?
Posted By :
Posted Date :
July 29, 2011
"Web.config" applies settings to each web application, while "Machine.config" applies settings to all ASP.NET applications.
You can also find related Interview Question to
Difference between "Web.config" and "Machine.Config" ?
What is the difference between "Web.config" and "Machine.Config" ?
Configuration files are used to control and manage the behavior of a web application.
One Machine.config file is shared for all ASP.NET's Application. It is only one on the machine for each version of .NET Framework. If you apply anything in machine.config file then it is applied on all ASP.NET applications. Machine.config file is universal on the machine. It can be located in the %runtime install path%\Config directory.
1. This is automatically installed when you install .NET Framework or Visual Studio. Net.
2. This is also called machine level configuration file.
3. Only one machine.config file exists on a server/computer.
4. This file is at the highest level in the configuration hierarchy
Web.config file is only for particular ASP.NET application. each ASP.NET application has different file. One ASP.NET application can have more than one web.config file. But only one in one folder.
1. This is automatically created when you create an ASP.Net web application project.
2. This is also called application level configuration file or folder level configuration file.
3. This file inherits setting from the machine.config. If same setting key is defined in both Machine.Config and Web.config, the Web.Config setting is used.
Difference Between Machine.config and Web.config
Machine.config is automatically installed when you install .NET Framework or Visual Studio. Net.
Web.config is automatically created when you create an ASP.Net web application project.
Machine.config is called machine level configuration file. Only one machine.config file exists on a server.
Web.config is called application level configuration file.
Machine.config file is at the highest level in the configuration hierarchy.
Web.Config file inherits setting from the machine.config
Difference Between Machine.config and Web.config?
Machine.config->Configuration file for all the applications in the system.
Web.config->Config file for single application.
What is the difference between Machine.config and web.config?
The main difference between Machine.config and web.config is as follows:
Machine.config is machine level config file,means if you make any changes into this file, it will applicable for all application which exists on same machine.
While Web.config settings only applicable for application level.This file is best place to keep your connection string and SMTP like settings and so on.
What is the difference between machine.config and web.config?
With every CLR(Common Language Runtime) of the .Net framework a machine.config file is there. This machine.config file is automatically installed with the .Net framework.
"machine.config", as its name suggests, it provides machine level configuration for the entire machine on which this machine.config file is installed with the .net framework, so it is also called machine level configuration file.
And since it provides setting for the entire machine, so there should be ONLY one machine.config file on a particular machine(computer/server).
This machine.config file is at the highest level in the configuration hierarchy, means, the .net framework will first check the configuration written with the machine.config file, then .net framework can look for any other configuration file.
There is also a web.config file which is also get installed with the .net framework, automatically.
In case of ASP.Net, a web.config file is also there with each Web Application. So when an ASP.Net website is running on a server, its settings will be the combination of the settings mentioned in machine.config file on that particular server, on which this website is running + the settings mentioned with the web.config file of that same server + the settings mentioned with the web.config file of the website's own, which is available into the website's own root directory.
Web.Config vs Machine.config
Web.Config Files - It is used to maintain the all type of
configuration like that Database connection and Error log
configuration and also maintain the Authenticate of user
security of the web application
Machine.config - only one file was created in your
microsoft .net folder when you installed the microsoft
So, it is used to configuration for the particular server
Difference Between Web.Config file and Global.asax ?
Web.Config file is used ....
1. To specify the application settings
2. To specify the session mechanism available to use for that application.
3. To Specify the Connection strings.
4. To Specify the authentication and authorization.
5. To Specify the http handlers.
6. To Specify different providers.
Global.asax file is used to specify the session and application event handlers.
Difference between web.config and app.config?
web.Config -- used in Web Application
app.config -- used in Windows application
What is the difference between web.config and global.asax?
web.config:- It is a xml based file.
glbal.asax:- It is class file.
web.config:- It carries configuration data of the ASP.Net website.
global.asax:- It carries application events of the ASP.Net website.
web.config:- If there will be any change made on this file, we need to just save the new file with the ASP.Net website.
global.asax:- If there will be any change made on this file, we need to compile/rebuild the ASP.Net website.
Difference Between Delete and Truncate
.Delete table is a logged operation, so the deletion of each row gets logged in the transaction log, which makes it slow.
. Truncate table also deletes all the rows in a table, but it won't log the deletion of each row, instead it logs the de-allocation of the data pages of the table, which makes it faster. Of course, truncate table cannot be rolled back.
. Truncate table is functionally identical to delete statement with no "where clause" both remove all rows in the table. But truncate table is faster and uses fewer system and transaction log resources than delete.
. Truncate table removes all rows from a table, but the table structure and its columns, constraints, indexes etc., remains as it is.
. In truncate table the counter used by an identity column for new rows is reset to the seed for the column.
. If you want to retain the identity counter, use delete statement instead.
. If you want to remove table definition and its data, use the drop table statement.
. You cannot use truncate table on a table referenced by a foreign key constraint; instead, use delete statement without a where clause. Because truncate table is not logged, it cannot activate a trigger.
. Truncate table may not be used on tables participating in an indexed view.
Difference between assembly manifest & metadata?
assembly manifest - An integral part of every assembly that renders the assembly self-describing. The assembly manifest contains the assembly's metadata. The manifest establishes the assembly identity, specifies the files that make up the assembly implementation, specifies the types and resources that make up the assembly, itemizes the compile-time dependencies on other assemblies, and specifies the set of permissions required for the assembly to run properly. This information is used at run time to resolve references, enforce version binding policy, and validate the integrity of loaded assemblies. The self-describing nature of assemblies also helps makes zero-impact install and XCOPY deployment feasible.
metadata - Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on. This can include information required for debugging and garbage collection, as well as security attributes, marshaling data, extended class and member definitions, version binding, and other information required by the runtime.
What is the difference between ref & out parameters?
An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.
What is the difference between a Struct and a Class?
The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. Although it is possible to represent a point as a class, a struct is more efficient in some scenarios. For example, if you declare an array of 1000 Point objects, you will allocate additional memory for referencing each object. In this case, the struct is less expensive.
When you create a struct object using the new operator, it gets created and the appropriate constructor is called. Unlike classes, structs can be instantiated without using the new operator. If you do not use new, the fields will remain unassigned and the object cannot be used until all of the fields are initialized.
It is an error to declare a default (parameterless) constructor for a struct. A default constructor is always provided to initialize the struct members to their default values.
It is an error to initialize an instance field in a struct.
There is no inheritance for structs as there is for classes. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Structs, however, inherit from the base class Object. A struct can implement interfaces, and it does that exactly as classes do.
A struct is a value type, while a class is a reference type.
Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
(Class constructor method is also known as type constructor or type initializer)
Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed. (It will get executed only 1st time, when we call any static methods/fields in the same class.) Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention.
What is the difference between Finalize and Dispose (Garbage collection)
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object.
In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object. Dispose can be called even if other references to the object are alive.
Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose.
Quick Links For Interview Questions Categories:
Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.
So, Start looking our
section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.
Hall of Fame
Terms of Service
Tell A Friend