• 配置子目录Web.config使其消除继承,iis7.0设置路由


    iis7.0设置路由 ,url转向,伪静态

    <system.webServer>  
        <modules runAllManagedModulesForAllRequests="true" />  
        </system.webServer>

    配置子目录Web.config使其消除继承  

    不用修改根目录的Web.config文件,而是修改子目录的Web.config。假设根目录的Web.config设置了一个名为 BlogEngine的连接字符串,要在子目录使用另一个名字为BlogEngine的连接字符串,就需要先清除已有的连接字符串(根目录继承下来的 connectionString设置),清除所有的配置,可以用clear语法,清除指定名称的配置,可以用remove语法,如下

    <--根目录的Web.config-->
    <connectionStrings>
      <add name="BlogEngine" connectionString="Data Source=localhostSQLEXPRESS; Initial Catalog=BlogEngine1; User ID=xxx; Password=xxx" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <--子目录的Web.config(clear方法)-->
    <connectionStrings>
      <clear/>
      <add name="BlogEngine" connectionString="Data Source=localhostSQLEXPRESS; Initial Catalog=BlogEngine2; User ID=xxx; Password=xxx" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <--子目录的Web.config(remove方法)-->
    <connectionStrings>
      <remove name="BlogEngine"/>
      <add name="BlogEngine" connectionString="Data Source=localhostSQLEXPRESS; Initial Catalog=BlogEngine2; User ID=xxx; Password=xxx" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    

    这里只是用connectionString为例,使用时完全可以应用在所有可以配置的节点上,任何配置节点都可以用clear和remove节点 将继承来的配置先清除掉,然后再add新的配置。此方法灵活性更强,同时可以保留根目录Web.config中的部分共同配置(而无需全部重新设定)。

  • 相关阅读:
    推荐一款优秀的web自动化测工具
    基于kylinTOP工具的HTTP2压力测试
    SIP压力测试——奇林软件kylinPET
    软件WEB自动化测试工具之智能元素定位
    软件自动化测试工具之智能元素定位
    软件自动化测试工具之元素智能定位
    压力测试工具有哪些
    optimizing Wi-Fi solution for International School
    All in One我有一个梦想,所有的应用程序都可以跑在tablet上面
    C#.Net全栈工程师之路-学习路径
  • 原文地址:https://www.cnblogs.com/w158357686/p/4579954.html
Copyright © 2020-2023  润新知