machine.config vs web.config question

 

can we use machine.config file instead of web.config file asp.net?

if yes ,how?

can u give me example?

0
ashishpayghan
6/13/2008 12:20:46 PM
asp.net.faq 380 articles. 0 followers. Follow

7 Replies
916 Views

Similar Articles

[PageSpeed] 36
Get it on Google Play
Get it on Apple App Store

Hi,

the machine.config is the ultimate master config file on your system with a lot of default settings. When you use web.config files, which is done in a cascading order, you're actually overwriting these settings with new ones. It's advised to keep the machine.config as is as much as possible so to not get conflicts with other applications.

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
6/13/2008 12:29:01 PM

You can use either one. Keep in mind, however, that settings to the machine.config will affect ALL sites on your server, whereas the web.config will only affect your current site.

If you want to edit your Machine.Config, it will probably be located at (Assuming that you're running .NET 2.0+):
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config

0
Chris
6/13/2008 12:31:10 PM

Machine.config is the file that has the master settings for the machine and affects not only asp.net but other .NET applications. It is advisable not to mess with it. Since the configuration settings cascade ie  web.config in the machine gets overridden by settings in the app etc.. it is advisable to use the application level web.config for app specific settings 


Jeev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
0
Jeev
6/13/2008 12:33:07 PM

Yes the changes you made to web.config will only take effect on the project of whom  you are changing values, and  the changes  apply to machine.config  applies to all  projects.


ROAMER!

if (myReply.Equals(YourAnswer))
{
MarkThisThread = "Answerd";
}
0
ROAMER
6/13/2008 12:34:09 PM

It is best to leave the machine.config file alone.  Use your web site web.config, or some other config file in your web site, to control the configuration.  That way you're only affecting your web site, not all web sites.

Hope this helps.

 



Sincerely,
Malcolm Sheridan
Microsoft Certified Solution Developer
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
Answer" if a marked post does not actually answer your question.
0
malcolms
6/13/2008 12:35:49 PM

The machine.config and web.config are "merged" (in memory, not physically) by the ConfigurationManager class. So the ConfigurationManager will load all connection strings from machine.config *and* all connection strings from web.config. You can access any connection string from either file the same exact way. To test this, try putting a connection string in your web.config with the same "name" as the connection string in your machine.config. You'll get an error.

Now, having said that, it's fairly common for people to start off the <connectionStrings> element of their web.config with a <clear/> tag. What that does is effectively remove all previously loaded connection strings (namely, those loaded from machine.config). If your web.config contains this <clear/> tag then the connection strings defined in machine.config will be unavailable.

 
Hope that helps


Techie (.Net Knowledge at its Best)


We make a living by what we get, but we make a life by what we give.
::: Winston Churchill :::
0
PassHours
6/13/2008 12:36:02 PM

You want to make a configuration setting change that will be global to all Web and Windows applications on the current computer please use machine.config.

otherwise you can use web.config.

 
When u use web.config file in asp.net it ill override the machine.config file settings, while you initially run your Web application.

 

 

Mark this as answer if this post helps u? 


 

 

 

 

0
bakkianathan
6/13/2008 1:26:43 PM
Reply:

Similar Artilces:

Membership: machine.config vs web.config
Hello,I'm new to ASP.NET, so please don't kill me, if this question is too simple ;-)The login control and Membership function I Framework 2.0:My connection to the MSSQL 2005 (not Express) server is working fine, but all information was placed in the machine.config by something I did wrong.Can I move all this to the web.config and expect it to work, when I export my project to the webserver:  <connectionStrings>    <add name="FamilyLinked" connectionString="Data Source=server001-32-64;Initial Catalog=xxx;Persist Security Info=True;User ID=x...

Web.config vs Machine.config overrides
I recently attended a MS ASP.NET seminar and was confused by the speaker said about how the web.config overrides the machine.config settings. This question has been asked previously but the answer went both ways from what I've searched on the forums. All I want to do is disable the TRACE.AXD method, which I can do in the machine.config, however the speaker then said that if someone knew how to write the code into their web.config, then it would become activated. So, the question is, does the web.config for a client (either created by accident, purposely, or maliciously) ALWAYS over-ri...

Configuration Files FAQs (web.config, machine.config...)
 What is Web.Config File? It is an optional XML File which stores configuration details for a specific asp.net web application.  Note:  When you modify the settings in the Web.Config file, you do not need to restart the Web service for the modifications to take effect..  By default, the Web.Config file applies to all the pages in the current directory and its subdirectories.   Extra:  You can use the <location> tag to lock configuration settings in the Web.Config file so that they cannot be overridden by a Web.Config file located bel...

Read info from web.config, machine.config, app.config....
I know how to read info from the web.config, see code:  Protected path As String = "/Framework" Protected config As Configuration = WebConfigurationManager.OpenWebConfiguration(path) How can I read also the data from machine.config and other config files, like the app.configs?Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". ...

Machine.config and web.config
If i have a key named X in my machine.config which equals to the value X and a key named X(same name as the one in the machine.config) in my web.config which equals to the Y.When i use my code to read in the configuration appsettings key.What value will it read in?X or Y? Y The web.config will override values set in the machine.config. You can also overrride values in each directory of your application (or each file for that mater) by setting <location> tags....

Machine.config and Web.config
Is there a way to get VWD to default to storing DB Connections and provider information in the projects web.config instead of machine.config? When I use the web admin feature it stores everything in the machine.config. The reason I ask this: I am developing the web apps local using my production DB server. I would like to just upload the site to the production server and ahve it work. We host multiple sites and I would like for all the site specific config information to be stored in it's own web.config. I know i could manually set it up in the web.config, but it would be nice to ...

Machine.config and Web.config
 I want to know list of settings in machine.config which cannot be overridden in web.config.. Thanks a lot in advance  I don't think that this information is specifically listed anywhere, but you can look in machine.config and look for: allowExeDefinition="MachineOnly"If you're running IIS 7 you need to also look at applicationhost.config and overrideModeDefault="Deny"...+++ Rick ---   Rick StrahlWest Wind TechnologiesMaking waves on the Web www.west-wind.com/weblog Thanks for reply can u tell me how can i look my IIS version...

Management of machine.config and machine level web.config
I have several large, 4 node , IIS6, CIFS back end content,  hardware load balanced web clusters used for intranet hosting for a large uk corp, fairly text book shared hosting design, each site runs under a unique AD account, providing a security boundary to other sites on the same server/platform by default in our config, asp.net runs under a custom trust based on medium trust + OLEDB and a few other things, on a fairly regular basis we stumble on a assmebly or app which requires higher trust level, more often than not we, create a new custom trust file the minimum in to ...

machine.config orverriding web.config?
I've installed a .Net app on a host machine and it's throwing an error. Unfortunately, I can't see the error details (I suspect a connection problem to the database), even though in my root web.config file I have customErrors mode="Off" When I hit the site, I get the default error message about setting customErrors to Off, even though that is the way it's currently set in web.config. Is there any way that the host's machine.config can override web.config? The host has said that they've never hosted any third-party apps before (client's requirement on hosting). I'm thinking ...

Web.Config/Machine.Config
Hi, When i open or save these 2 files (Web.Config and Machine.Config), this error message comes out : The memory cannot be written. Then, my web application (ASP.NET) cannot be access at all, until i click OK for that error message. May i know what is the problem and how am i going to solve it? Thanks....

How to override machine.config in web.config
I'm trying to override parameter settings in machine.config for the password.format and membership parameters with entries in web.config file. example <membership>        <providers>          <add name="AspNetSqlMembershipProvider"  type = "System.Web.Security.SqlMerbershipProvider, System.Web, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"   connectionStringName="LocalSqlServer"  enablePasswordRetrieval="tr...

Differences between Web.Config and Machine.Config
 Hi All,   I am new to asp.net,pls list "Differences between Web.Config and Machine.Config" or share any urls on the topic.RegardsSriRam    web.config allows you to add configuration settings for a specific website that contains that specific web.config file.  you can additionally create web.config files in specific folders of your website and their setting apply just to that folder and below. machine.config also contains configuration settings, but they apply to the entire machine (all websites) unless a specific web.config has overridden them. &n...

web.config vs app.config
So, I'm building a composite control that has 3 web references I dynamically set in the Settings/app.config file.  What I'm looking for is a way to allow the consuming developer to edit the URLs in design-time.  However, I can't seem to get to the configuration of my compiled DLL.  Can anyone suggest a way, using code or web.config or whatever, that will allow me to do this?Chris StewartCompiledMonkey.com Anyone?Chris StewartCompiledMonkey.com Look at your generated proxies (from wsdl.exe or WS add web reference feature, which are basically the same). You should be able to...

Web.config and machine.config conflict
We're getting the "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level." error recently. I know what you're going to say, set the virtual directory as an application. We have!Specifically, we have a web site that is an app with numerous virtual directory applications pointing to different projects. And 99.9% of the time there are no issues. But occassionally people get a 500 error and the exception we get back (we use exception publishing) is always this one. It's flagging the <authentication> node as the troublemaker.Any ideas?...

Web resources about - machine.config vs web.config question - asp.net.faq

German question - Wikipedia, the free encyclopedia
"Kleindeutschland" redirects here. For the neighborhood in New York City, see Little Germany, Manhattan . 1820 map of Central Europe showing ...

Questions raised over fairness of drug-driving charges as arrests double
NSW courts have been inundated with drug driving cases as arrests more than doubled in 2015, triggering concerns that people are being penalised ...

First Hill Streetcar launch party planned — only question is when — UPDATE: SATURDAY SOFT LAUNCH
As of last Wednesday, Seattle Department of Transportation officials have a plan for the event to launch the First Hill Streetcar including a ...


8 Questions We Have After Watching That Insanely Epic 'Suicide Squad' Trailer
Who is the villain? Where is Harley's accent? Are we all going to love The Joker?

What To Do When The Job Interviewer Doesn’t Ask The Right Questions
What To Do When The Job Interviewer Doesn’t Ask The Right Questions

Israel warms to Sunni powers, questions US' Palestinian focus
Israel warms to Sunni powers, questions US' Palestinian focus

New series ‘Dark Net’ raises questions about tech’s hidden side
Many of us have a love/hate relationship with the role technology plays in our lives. We adore our mobile devices, our favorite apps, and websites, ...

Exhibit of Bill Cosby's Art Led to Ethical Questions
A Smithsonian exhibit funded by Bill Cosby and his wife that showcases art from their private collection led to questions about the cultural ...

Martin Shkreli Subpoenaed By Congress, ‘Pharma Bro’ To Answer Questions About Jacking Up Drug Prices
Martin Shkreli, the reviled hedge fund manager who earned the nickname “Pharma Bro” for buying the rights to a lifesaving drug, jacking up the ...

Resources last updated: 1/23/2016 11:57:06 PM