只需要在根目录设置:<location path="." allowOverride="false" inheritInChildApplications="false"></location>,子目录需要设置成虚拟目录的方式,然后在访问子目录的时候就将不会在读取根目录下的web.config的配置信息了。