Coldfusion错误和IIS7.5错误页 [英] Coldfusion Error and IIS7.5 Error Pages

查看:154
本文介绍了Coldfusion错误和IIS7.5错误页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了让ColdFusion显示它的错误,而不仅是服务器错误(代码500),我已经添加到web.config根据本网站的一些发现。

In order to allows ColdFusion showing its errors instead of just server error (code 500), I have added to web.config according to some findings in this site.

问题看起来解决了但是...

The problem looks resolved but...

当我访问IIS中不存在的目录时,它返回一个没有任何状态代码的空白页面。如果我将其从passthrough设置为自动,IIS再次出现错误页面,没有更多的ColdFusion错误显示。

When I visit a non-existed directory in the IIS, it returned a "blank" page without any status code. If I set it from passthrough back to auto, the IIS takes the error page again and no more ColdFusion errors showed.

任何人都有解决方案?我做了一些研究,怀疑JWildcardhandler可能是问题,但我找不到解决方案。

Anyone has a solution? I did some research and "suspect" that the JWildcardhandler maybe the problem, but I couldn't find a solution to this.

非常感激!

推荐答案

如果任何人想知道这个人的网络配置可能看起来像这样:

In case anyone is wondering this person's web config probably looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
        ...
    </system.webServer>
</configuration>



在早期版本的IIS中,如果您的自定义脚本返回错误代码,IIS会忽略它,并让它通过。 ,您也可以设置它来处理自定义脚本的错误状态。

In earlier version of IIS, if your custom script returned an error code, IIS ignored it and let it through. But you could also set it up to handle error status with custom scripts.

在我的旧服务器上,如果给定的URL是404,IIS被设置为执行/404.cfm,显示错误页面 em>使用< cfheader> 返回404状态代码。

On my old server, if a given URL was a 404, IIS was set up to execut /404.cfm, which displayed an error page and returned a 404 status code using <cfheader>.

>如果该脚本返回404状态代码,则最终结果是IIS返回服务器错误,而不是返回带有404状态代码的响应。

However, now if that script returns a 404 status code, the end result is IIS returns a server error rather than return the response with the 404 status code.

即使用 existingResponse =PassThrough,然后使用在CFAdmin中设置的网站范围的Template Not Found模板。

The only way to avoid that is by using existingResponse="PassThrough" and then using a site-wide "Template Not Found" template, set in CFAdmin.

这里是有趣的部分。我将index.cfm设置为默认索引,并为我的网站设置了默认索引。

Here's the interesting part. I have index.cfm set up as the default index, and the only default index, for my site.

如果我转到 / about / ,并且 /about/index.cfm 存在,那么它呈现页面,就像我已经请求 /about/index.cfm
如果我转到 /about/index.cfm /about/index.cfm < / strong> 存在,则其执行站点范围404模板。

If I go to /about/, and /about/index.cfm exists, then it renders the page, as if I had asked it for /about/index.cfm. And if I go to /about/index.cfm and /about/index.cfm does not exist, it executes the site-wide 404 template.

转到 / about / / about / 不作为URL存在, em>尝试加载 /about/index.cfm ,从而触发站点范围404模板。相反,它呈现一个空白页!

But if I go to /about/ and /about/ does not exist as an URL, it does not attempt to load /about/index.cfm and thus trigger the site-wide 404 template. Instead, it renders a blank page!

据我所知,没有可行的解决方案。看起来只有在.Net中写的人才能解决这个问题,因为他们可以在它们生成的响应中放置一个标志,从字面上告诉IIS忽略状态码。我认为微软根本不感兴趣支持替代网络应用程序。

As far as I can tell, there is no workable solution to this problem. It looks like only people writing in .Net can resolve this issue, as they can put a flag in the Response that they generate that literally tells IIS "Ignore the status code". I think that Microsoft simply isn't interested in supporting alternate web application.

基本上,这是解决方案:
$ c> existingResponse =PassThrough并返回错误的状态代码

Basically, this is the solution: get rid of existingResponse="PassThrough" and return the wrong status codes.

其他任何东西都难以实现。请注意,如果您正在制作RESTful应用或API,则此操作无效。在这种情况下,您必须创建一个虚拟目录,您可以为其分配一个自定义的web.config文件 使用 existingResponse =PassThrough。但是,如果您需要能够允许自定义错误处理和自定义404处理,那么您就会受到影响。

Anything else is going to be too hard to implement. Note that this does not work if you are making a RESTful app or API. In which case, you must create a virtual directory just for that, for which you can assign a custom web.config file which does use existingResponse="PassThrough". But if you need to be able to allow custom error handling and custom 404 handling, you are effectively screwed.

好消息是,除了API和Ajax之外,其他时候有人会关心状态代码实际上是什么时,他们正在看着你的头,无论如何,他们会看到你正在运行IIS,只为你感到遗憾。

The good news is, apart from API and Ajax, the only other time someone will care about what the status code actually is will be when they're looking at your headers anyway, in which case they will see you're running IIS and just feel sorry for you.

这篇关于Coldfusion错误和IIS7.5错误页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆