ASP 安装
在 Windows 上启用 IIS 与 ASP、配置站点、验证运行。
Key PointsIIS 默认不启用 ASP,装完 IIS 还要单独勾选「ASP」功能,否则 .asp 文件会被当成下载或 404。
启用 IIS
Text
控制面板 → 程序和功能 → 启用或关闭 Windows 功能
☑ Internet Information Services
☑ Web 管理工具 → IIS 管理控制台
☑ 万维网服务 → 应用程序开发功能
☑ ASP
☑ ISAPI 扩展
☑ 服务器端包含The ASP entry under Application Development Features is required. With only the IIS core, .asp requests return 404.3 (no MIME mapping) instead of executing.
验证
Text
浏览器打开 http://localhost/
看到 IIS 欢迎页 = IIS 装好了ASP
<%-- 放到 C:\inetpub\wwwroot\test.asp --%>
<%
Response.Write "ASP 已启用<br>"
Response.Write "服务器时间:" & Now()
%>Output
ASP 已启用
服务器时间:2026/11/3 14:25:09常见配置项
| Setting | Where | Why |
|---|---|---|
| Default document | IIS → 网站 → 默认文档 | 加 index.asp 让目录访问直接命中 |
| Enable Parent Paths | ASP → 编译 → 启用父路径 | ../ 包含需要它 |
| Send Errors to Browser | ASP → 调试属性 | 开发期看错误详情 |
| Session timeout | ASP → 会话属性 | 默认 20 分钟 |
| Code page | 页面里 CodePage=65001 | 中文不乱码 |
"Send Errors to Browser" belongs in development only. In production it prints physical paths and source line numbers to users — the most common information leak in classic ASP.
目录与权限
Text
C:\inetpub\wwwroot\ ← 默认站点根目录
├── index.asp
├── includes\ ← 被包含的片段
│ └── header.asp
└── data\
└── app.mdb ← 数据库文件(要放在 Web 根外或用 ACL 保护)IIS reads files as IUSR. A database inside the web root can be downloaded by anyone — an exposed .mdb means the whole database leaks. Keeping it outside the root is the only reliable fix.
启用 IIS
Text
控制面板 → 程序和功能 → 启用或关闭 Windows 功能
☑ Internet Information Services
☑ Web 管理工具 → IIS 管理控制台
☑ 万维网服务 → 应用程序开发功能
☑ ASP
☑ ISAPI 扩展
☑ 服务器端包含「应用程序开发功能」里的 ASP 必须勾上。只装 IIS 主体的话,.asp 请求会返回 404.3(MIME 类型未映射),而不是执行脚本。
验证
Text
浏览器打开 http://localhost/
看到 IIS 欢迎页 = IIS 装好了ASP
<%-- 放到 C:\inetpub\wwwroot\test.asp --%>
<%
Response.Write "ASP 已启用<br>"
Response.Write "服务器时间:" & Now()
%>Output
ASP 已启用
服务器时间:2026/11/3 14:25:09常见配置项
| 设置 | 位置 | 原因 |
|---|---|---|
| 默认文档 | IIS → 网站 → 默认文档 | 加 index.asp 让目录访问直接命中 |
| 启用父路径 | ASP → 编译 → 启用父路径 | ../ 包含需要它 |
| 错误发到浏览器 | ASP → 调试属性 | 开发期看错误详情 |
| 会话超时 | ASP → 会话属性 | 默认 20 分钟 |
| 代码页 | 页面里 CodePage=65001 | 中文不乱码 |
「向浏览器发送错误」只能在开发环境开。生产环境打开它会把物理路径、代码行号直接显示给用户,是最常见的 ASP 信息泄露来源。
目录与权限
Text
C:\inetpub\wwwroot\ ← 默认站点根目录
├── index.asp
├── includes\ ← 被包含的片段
│ └── header.asp
└── data\
└── app.mdb ← 数据库文件(要放在 Web 根外或用 ACL 保护)IIS 用 IUSR 账户读取文件。数据库文件放在 Web 根目录下时,任何人都能直接下载——.mdb 被下载走就等于整个数据库泄露。放到 Web 根之外是唯一可靠的做法。