代码之家  ›  专栏  ›  技术社区  ›  awrigley

如何合并ASP.NET MVC和普通ASP.NET应用程序的web.configs

  •  1
  • awrigley  · 技术社区  · 15 年前

    合并一个传统的ASP.NET应用程序和一个新的MVC应用程序的web.config文件几乎让我大吃一惊。

    有没有办法把项目分割成子文件夹来构建我的解决方案?

    ~/PlainVanilla/ /* original asp.net app - still some life in old dogs */
    
    ~/PlainVanilla/StrawberryMVC /* juicy, suculent new MVC app */
    
    ~/PlainVanilla/GrumpyOldCMS /* Telerik Sitefinity app that takes
                                                       forever to compile */
    

    此结构会产生许多错误,这些错误是由子文件夹web.config重写~/planilla/web.config中不允许的设置引起的。

    我明白在有限的篇幅内,这是很难全面回复的,所以推荐的书籍、博客和文章将不胜感激。

    1 回复  |  直到 15 年前
        1
  •  2
  •   Taylor Bird    15 年前

    你可以使用

    <remove /> <clear /> 子web.configs中的标记有助于删除由于继承而导致问题的节。

    根据你需要改变的程度(听起来像很多),你可以用 <location> 同时禁用继承的标记。

    <location path="." inheritInChildApplications="false">
        <sectionName>
        </sectionName>   
      </location>
    

    在web.config和web.config继承中搜索remove,您应该找到很多方法来使用它们。