ASP 安装

在 Windows 上启用 IIS 与 ASP、配置站点、验证运行。

Beginner
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

常见配置项

SettingWhereWhy
Default documentIIS → 网站 → 默认文档加 index.asp 让目录访问直接命中
Enable Parent PathsASP → 编译 → 启用父路径../ 包含需要它
Send Errors to BrowserASP → 调试属性开发期看错误详情
Session timeoutASP → 会话属性默认 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.

Friends & Partners