What is the purpose of machine.config file in .NET?

Machine.config file is a machine level configuration file that is installed automatically during Visual Studio .NET installation. Only one machine.config exists for a computer. Settings defined in this file apply to the entire machine. However you can define more specific application level settings in web.config file.




Your application will first access the settings in web.config file and if any specific setting is not available in web.config file then it will use the settings defined in machine.config file. Here is a sample structure of web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="connectionStrings"
type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false"/>
</configSections>
<runtime/>
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source= .\SQLEXPRESS;Integrated Security=SSPI; AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.data>
<DbProviderFactories>
<add name="Odbc Data Provider" invariant="System.Data.Odbc" description Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
</system.data>
<system.web/>
</configuration>

This is just a sample file. Many more tags are available in machine.config file.

_______________________________________________________________________

Add to My Yahoo!


FREE Subscription

Subscribe to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.

Name:
Email:

Note : We never rent, trade, or sell my email lists to
anyone. We assure that your privacy is respected
and protected.

Visit .NET Programming Tutorial Homepage

______________________________________________________

Recommended Resource

| What is the need for Bridge Pattern in C#? | What is the need for Builder Pattern in C#? | What is the need for Chain of Responsibility Pattern in C#? | What is the need for Command Pattern in C#? | What is the need for Composite Pattern in C#? | What is the need for Decorator Pattern in C#? | What is the need for Flyweight Pattern in C#? | What is the need for Interpreter Pattern in C#? | What is the need for Iterator Pattern in C#? | What is the need for Mediator Pattern in C#? | What is the need for Memento Pattern in C#? | What is the need for Prototype Pattern in C#? | What is the need for State Pattern in C#? | What is the need for Strategy Pattern in C#? | What is the need for Template Method Pattern in C#? | What is the need for unsafe code in C#? | What is the purpose of assert() in C#? | What is the purpose of AutoResetEvent in .NET? | What is the purpose of Console.ReadLine() in C#? | What is the purpose of machine.config file in .NET? |


| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.