Where is the Web.config supposed to go in an ASP.NET MVC project?
I just ran into an error trying to do this:
_cnstr = System.Configuration.ConfigurationManager.
ConnectionStrings["production"].ConnectionString;
The default MVC template puts the Web.config at the root of the project.
If you go into the properties of a project (the screen with the vertical tabs). Go to settings and try to create an application setting, it will prompt you that you don't have a config file. When it creates the file it does it at the base of the Views folder. So now I have two Web.config files. Is this how it supposed to be?
And I guess I should put my connection string in the "views" web.config to avoid the error.
Thoughts? Is this a bug in the last release of the ASP.NET MVC bits?
UPDATE:
See David's answer
question from:
https://stackoverflow.com/questions/517086/asp-net-mvc-and-two-web-config-files 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…