Click here to Skip to main content
15,886,919 members
Articles / Web Development / IIS

Many Web.config Have Merged Together

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
24 Nov 2014CPOL1 min read 6.9K   3  
Many Web.config have merged together

You can have more than one Web.config in an application and they will all be merged in the end, which is fine. Also, if you have a problem with the configuration for a given project, it will usually show up in your development environment right away and will not make it to production.

But here is a problem that occurred to me a few times and that had me pretty stumped at first. When deploying an ASP.NET MVC or ASP.NET WebForms application to an IIS (Internet Information Service) server, it looked like configurations from unrelated Web.config or other .config files merged together. Errors were popping up from assembly versions or configurations that should not even be used in the new application! So what were those mystery configurations?

In IIS, the Sites folder is a container for all the applications and virtual directories of the server. The Sites folder has a physical root directory even it if doesn’t contain files specific to an application. In fact, configurations files from that folder are merged with the configuration of all your applications. Here is the configuration in IIS for the physical path of that folder:

DefaultWebSite

In my case, the root folder pointed to another application on the same server, so the configurations made no sense for the new application. To solve the problem, I just made sure than the wwwroot folder was empty or contained only configurations that I intended to share with all the applications hosted on the server.

For references purpose, here is the configuration for the physical path of each individual application. You don’t need to point to a folder under wwwroot as long as the folder used has the proper permissions to be seen from the web.

HelloWorldApp

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Canada Canada
Cindy Potvin is a software developer based in the Montreal area. At her day job, she creates web applications using the ASP.NET MVC framework and mobile applications using the Android SDK.

Comments and Discussions

 
-- There are no messages in this forum --