Getting this error on an intranet application we have running in our development environment, and I\'m not sure where to go/look for a solution. The application used to work
I had this problem. I think I caused it to start happening by modifying some settings in the publish profile. Undoing those settings fixed my issue. Here's what I did:
I have VS2017
Just had this issue ... turned out to be a result of allowing debug information to be produced when publishing the Web App.
Publish Web App - Settings - File Publish Options - Precompile during publishing (true) - Configure - Emit debug information. (Should actually read "Omit debug information")
Delete Debug subdirectory of project and republish
This can also happen when you create a publish folderprofile if you take the default location, which is app.publish folder under your project folder. VS then gets confused and thinks there's another web.config it has to reconcile when building. Why does microsoft allow you to shoot yourself in the foot like this? Moving the Publish FolderProfile to another location stops the error from occuring.
In my case inside my web directory, I had an other web directory along with its own web.config file. When I removed that sub directory that was a complete website in its own my problem is fixed now.
any how web.config should be in the root directory most probably it happens when you don't have the solution file for your project. Close VS open it once again and choose the direct folder. Note web.config file should be in root directory or if you want to in sub directory then copy the webconfig file and create a new config file in the root. Caution:if you have mentioned any path in config file that will be lost
In some cases this could be caused by creating another sub-folder in your project and you added another Web.config
file which has the same filename as the other Web.config
file in the root folder.
To resolve this error, rename your newly added Web.config
file to another name.