Undefined Web.config error in VS 2008
Asked Answered
E

4

7

I'm working on a web app using VS 2008, .Net 3.5 and C#. Most of the projects in the solution are either classic asp.net pages with some MVC 1 in the mix, the rest is shared libraries. The solution is one that is some 5 years old and has gone through a variety of developers working on it and clearly has some performance and architectural issues.

Previously, I've been working on the project using VS 2008 on a Win XP machine, but have just transitioned over to a new box using Win 7 Ultimate. To do so, I've installed VS 2008, asp.net 3.5. To support future work on the solution I've also installed VS 2010 and asp.net 4.0.

Opening the solution on the new box with VS 2008 works fine, and it builds without error. However, when I attempt to run it with the debugger, I get the following message:

"There is an error in web.config. Please correct before proceeding. (You might rename the current web.config and add a new one.)"

I think it's clear that there is some sort of environmental issue regarding web.config on the new machine, but the error message is not "helpful". Adding a new web.config is not an option as the existing one is quite long and involved (too much to post here).

I'm hoping someone has a suggestion or two about where I might look for missing elements or changed configurations that might produce such an error message. Lacking that, I'll revisit this post and provide the web.config in the hope that will elicit further help.

Extravasate answered 25/11, 2011 at 17:47 Comment(1)
I'm having a very similar issue in VS2013... It had been working fine, so I'm not sure what changed. It will run if I have the web.config open in the editor, however... Very odd.Plenteous
P
21

So I don't know if you ever found an answer to this, but I ran into it in VS2013 today. Oddly, it would work if I had the web.config open in an editor window.

For others who may see this error I was able to clear it in VS2013 by deleting the \bin and \obj directories.

After that, it worked fine again...

Plenteous answered 20/12, 2013 at 15:48 Comment(2)
exact same behavior here. bizzare.Hanky
Same problem using VS2015. If I open the file, there are no errors. If I leave the file open in an editor window when I hit run/debug, it works. Closing VS, deleting all \bin and \obj, re-opening the solution and re-building seems to have fixed it.Fighter
B
0

To maybe give you a better idea of what the web.config problem is, I would follow the suggestion of renaming the current one and adding a new one. You can use a diff tool (e.g. WinMerge) to find out what the differences are between your existing config file and the "clean-slate" new one.

You can copy the non-issue sections from the old one to the new one, like the connection strings and the application settings, forms authentication modes, etc. You might have something wrong with the compiler section or something a little more specific to the .NET framework.

Did you convert the project at all from targeting .NET 2.0 to .NET 3.5? There's a big web.config section that gets added to 3.5 projects that wasn't required for 2.0 projects regarding the compiler, as it uses a separate compiler for .aspx inline-code than was used for 2.0.

Bethannbethanne answered 25/11, 2011 at 17:57 Comment(1)
The project was converted to 3.5 some time ago, and was running w/ VS 2008 under XP. The only change was moving to a Win 7 machine. I'm trying to debug using the VS Dev Server, not w/ IIS 7.x directly. I'll try creating a new web.config as a last resort due to its complexity (meaning that there are a LOT of app settings and other things that may or may not be critical. IOW, a bag of worms...)Extravasate
E
0

iis 7.5 (on windows 7) is a pretty different animal than iis 6 (on windows xp). there are some configuration incompatibilities. one thing that comes to mind is a little different schema for the attributes on the elements for http handlers and modules. there are other things that are different. usually on the error page, it will tell you what it doesn't like. i imagine it was there and maybe you didn't notice it. or maybe you were hitting the page remotely and it didn't have all the detail. i suggest using a browser on the local machine and take a closer look - pretty sure it will tell you what is making it puke.

Emersion answered 25/11, 2011 at 18:5 Comment(2)
I'm using the VS web server, so it never gets as far as loading a page. The error message I'm getting is a popup in VS.Extravasate
i'd try running it in iis and see what you get.Emersion
B
0

I ran into this ambiguous error for the first time today in VS2019. I had added a new Entity Model (.edmx) which required adding a new connection string to a separate project's web.config. After adding it, I immediately started getting the error on startup. I noticed there were several config transforms for the various environments. After adding the missing transformed connection strings to each of them that error has gone away.

Baumgartner answered 30/9, 2020 at 17:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.