In my solution, I have 2 projects, name them Foo and Bar . When deployed, Foo is the root site (http://mycompany.com) and Bar is a subdirectory (http://mycompany.com/sub).
When I work on them locally in IIS Express on my local machine, I need to replicate things in the web.config of both projects, since I work on them separately. For example, I have one of the Boilerplate HMTL5 rules for "cache enumeration" in my rewrite rules:
<rewrite> <rules> <rule name="Cachebusting"> <match url="^(.+)\.\d+(\.(js|css|png|jpg|gif)$)" /> <action type="Rewrite" url="{R:1}{R:2}" /> </rule> </rules> </rewrite>
If I just leave it in the web.config file for Foo , then when I work on Bar , it does not apply, and I get errors since the rewriting does not occur. Therefore, I replicated sections in web.config for both projects.
But when I publish the Azure solution, I get conflicts due to inheritance rules, since web.config for Foo is at the root.
What is the best way to manage this? I tried to search on this topic, but could not find this specific problem.
Update:
My applicationhost.config for IIS Express is as follows:
<site name="Bar" id="3"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="E:\Code\mycompany\Bar\Bar" /> </application> <bindings> <binding protocol="http" bindingInformation="*:65052:localhost" /> </bindings> </site> <site name="Foo" id="4"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="E:\Code\mycompany\foo" /> </application> <bindings> <binding protocol="http" bindingInformation="*:50477:localhost" /> </bindings> </site>
I tried to edit it to make both applications part of the same site, with these changes, but no luck. Seems to have broken everything :)
<site name="Foo" id="3"> <application path="/" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="E:\Code\mycompany\foo" /> </application> <application path="/Sub" applicationPool="Clr4IntegratedAppPool"> <virtualDirectory path="/" physicalPath="E:\Code\mycompany\Bar\Bar" /> </application> <bindings> <binding protocol="http" bindingInformation="*:65052:localhost" /> </bindings> </site>