The alternative title to this post could be "stop nagging, thats my wife's job". But enough about that… :-). This is story about a small configuration section that just don't scale that well in larger EPiServer projects. I'm talking about the automaticSiteMapping section inside EPiServerFramework.config file in EPiServer CMS 6. This section contains the mapping between an EPiServer Site and the associated IIS application on the current machine. The configuration looks something like this:
<add key="/LM/W3SVC/17/ROOT:MyComputer" siteId="MySite" />
The mapping is added automatically to the config file by EPiServer when it does not find an existing valid mapping. The problem with this is that the application needs write access to the EPiServerFramework.config file. Just add write permission to the web folder and your done. Nope, not that simple. For those of you that uses TFS is familiar with the read-only flag on checked in files. This will trigger this wonderful screen at startup, telling you what the file can't be edited.
Now just imagine how this effects a team of 5 developers working on a enterprise site with 25 sites. 5 * 25 = 125 exceptions leading to a check out of the EPiServerFramework.config file, add the mapping and the check in the updated file. Annoying? Yes! Branching of the code branch will even making it worse result in new sites being added with its own host bindings and a new 125 extra mappings (puhh!) to be added for each branch; making this to one big maintenance nightmare.
The workaround (/hack)
One simple solution to get around this is just to do the following
1. Remove all (!!!) mappings inside the automaticSiteMapping section
2. Add the following xcopy statment to post build event on episerver project in Visual Studio
xcopy "$(ProjectDir)EPiServerFramework.config" "$(TargetDir)" /Y
3. Change the path to the EPiServerFramework.config file in web.config like this
<episerver.framework configSource="bin\EPiServerFramework.config" />
These three steps will copy a clean writable instance of the EPiServerFramwork.config file to the bin folder when the solutions is compiled. Resulting in the IIS mapping be added with no problems when the application is started.
This is a little how-to on making it easier to share your episerver projects between multiple developers by making the location of the episerver resources more abstract. [More]