为什么#Ininclude 不能在 IIS7 上的 .asp 页面上工作?

发布于 2024-07-13 14:17:44 字数 679 浏览 5 评论 0原文

症状:

我的Test_virtual.asp包含以下内容:

<body>&nbsp;
included content starts here:
<!--#include virtual="/test_included.txt"-->
</body>

test_included.txt仅包含:

这是包含的文件

当我浏览到 test_virtual.asp 时,我没有看到包含的文件的文本。

可能的原因
我发现一份报告表明 II7 中的 Includes 默认被禁用: http:// tech.mikeal.com/blog1.php/2008/08/05/server-side-includes-for-html-in-iis7

但这些说明假定您有权访问实际计算机的控制面板。

SYMPTOM:

I have Test_virtual.asp with the following:

<body> 
included content starts here:
<!--#include virtual="/test_included.txt"-->
</body>

test_included.txt contains only:

This is the included file

When I browse to test_virtual.asp, I don't see the included file's text.

POSSIBLE CAUSES
I found one report that indicated the Includes are disabled by default in II7:
http://tech.mikeal.com/blog1.php/2008/08/05/server-side-includes-for-html-in-iis7

But the instructions assume you have access to the actual machine's control panel.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山田美奈子 2024-07-20 14:17:44

更多信息:问题似乎是默认情况下禁用“包含”。 我发现我可以访问 IIS7 管理器中的处理程序设置,但它告诉我必须在配置文件中直接管理它们,因为该站点位于以经典模式运行的共享应用程序池中。

需要多少程序员才能解决这个问题?
没有任何。 这是一个 IT 问题。

More info: it looks like the issue is that Includes are disabled by default. I figured out that I can get to the Handler Setting in the IIS7 Manager but it's telling me that I have to manage them direclty in the config file b/c the site is in a shared app pool running in Classsic mode.

How many programmers does it take to fix this problem?
None. It's a an IT problem.

懒的傷心 2024-07-20 14:17:44

尝试使用文件而不是虚拟:

<!--#include file="../test_included.txt"-->

<!--#include file="test_included.txt"-->

取决于您的文件所在的位置。

我还假设您的 IIS7 服务器已启用经典 ASP 支持,因为我很确定默认情况下它不存在。

当您在浏览器中查看源代码时,您能看到该指令吗? 这可能会告诉您它是否被忽略或者是否只是失败。

Try using file instead of virtual:

<!--#include file="../test_included.txt"-->

or

<!--#include file="test_included.txt"-->

depending on where your file is.

I'm also assuming classic ASP support has been enabled for your IIS7 server as I'm pretty sure it isn't there by default.

Can you see the directive when you view source in the browser? That might tell you if it is being ignored or if it is just failing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文