So I maintain multiple branches, one for on-going development and the other for production support. Although Git has a feature to switch branches, it does some magic in the background which moves files and require you either to stash your changes or commit, which can be inconvenient, so instead I have the branches checked out to multiple directories.
This normally works well, unless you use IIS Express for debugging your web solutions. It turns out that IISExpress maintains an “applicationhost.config” file in MyDocuments\IISExpress\config folder. Now this nasty booger seems to know how to change the file selectively, typically when I really don’t want it to.
So as I was making a bug fix today, it managed to switch it automatically as I changed branches and life was good. After that, I go back to my enhancement branch and start cranking away. A few hours later when I’m ready to debug, I launch the app and then I notice funky artifacts in the behavior. I seem to have lost my changes! Or did I?
It was the config file. In it, you’ll find a section that would look similar to the following.
<sites> <site name="Awesome.App.Services" id="1541412810"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="D:\ProductionBranch\Awesome.App.Services" /> </application> <bindings> <binding protocol="https" bindingInformation="*:44301:localhost" /> </bindings> </site> <site name="Awesome.App.MvcClient" id="1541412811"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="D:\ProductionBranch\Awesome.App.MvcClient" /> </application> <bindings> <binding protocol="https" bindingInformation="*:44302:localhost" /> </bindings> </site> .... </sites>
Now, when you work off another branch it theoretically should change automatically for you, saving you from murdering the people near you. However, it likes to only work sometimes and thus you have to change it back manually. After I changed it back, IIS ran from the correct location reflecting my current changes.
Leave a Reply
You must be logged in to post a comment.