zoukankan      html  css  js  c++  java
  • IIS7多域名绑定同一物理目录,设置不同默认文档的解决方案

    前两天遇到了IIS7多域名绑定同一物理目录,设置不同的默认文档的问题,因为在一个物理目录下只有一个web.config,并且IIS7把默认文档设置写在这里,导致所有域名的默认文档设置共享,很多人对此束手无策,甚至有人说这是IIS7的bug。

    其实IIS7不会比IIS6落后的,这个问题也很好解决,下面是解决方案:

    比如我们把www.a.com和www.b.com两个域名都指向c:wwwroot文件夹
    想把www.a.com的默认文档设为目录aaa下的index.htm,www.b.com的默认文档设为目录bbb下的index.htm

    1、新建两个站点,一个叫a1(站点名字自己来起),指向c:wwwroot文件夹,绑定域名www.a.com;另一个叫a2,指向c:wwwroot文件夹,绑定域名www.b.com

    2、进入%windir%system32inetsrvconfig目录(%windir%即windows的安装目录,比如c:windows)

    3、找到applicationHost.config文件,用文本编辑器打开

    4、在最后configuration节中加入如下语句

     

    1. <location path="a1">  
    2.         <system.webServer>  
    3.            <defaultDocument enabled="true">  
    4.               <files>       
    5.                     <clear/>  
    6.                     <add value="aaa/index.htm"/>  
    7.               </files>  
    8.            </defaultDocument>  
    9.        </system.webServer>  
    10.    </location>  
    11.    <location path="a2">  
    12.         <system.webServer>  
    13.            <defaultDocument enabled="true">  
    14.               <files>       
    15.                     <clear/>  
    16.                     <add value="bbb/index.htm"/>  
    17.               </files>  
    18.            </defaultDocument>  
    19.        </system.webServer>  
    20.    </location>  
    5、将web.config下网站自动生成的
    <system.webServer>
            <defaultDocument>
                <files>
                    <add value="index.aspx" />
                </files>
            </defaultDocument>
        </system.webServer>
    删除
    6、ok
  • 相关阅读:
    JS-只能输入中文和英文
    强密码正则表达式
    java 实体序列化的意义
    数据库中存在0,1,2.....或者1,null,2 排序时让0或者null在最后的sql语句
    Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法
    C#中的线程(二) 线程同步基础
    C#中的线程(一)入门
    C#多线程编程
    C#(asp.net )读取ASHX文件(一般处理程序)
    Oracle中三种循环(For、While、Loop)
  • 原文地址:https://www.cnblogs.com/sandea/p/3289887.html
Copyright © 2011-2022 走看看