直接访问 application.cfc 会产生未捕获的 ColdFusion 错误
我正在使用 application.cfc 开发一个新的 ColdFusion 9 应用程序,只是为了好玩,我想看看如果直接导航到 application.cfc 会发生什么,如下所示:
http://www.mysite.com/application.cfc
我有点惊讶地看到一个未捕获的错误,其实质是:
“应用程序请求无效。 cfm, Application.cfc 或 OnRequestEnd.cfm 文件”
经过一番研究后,似乎没有真正的方法可以在应用程序本身内处理此问题 - 或者至少到目前为止我还没有找到方法。
对于这个问题有什么好的解决方案吗?
提前致谢!
I'm developing a new ColdFusion 9 application using application.cfc, and just for kicks I wanted to see what happens if I navigate directly to application.cfc, like this:
http://www.mysite.com/application.cfc
I was somewhat surprised to see an untrapped error, the meat of which is:
"Invalid request of Application.cfm, Application.cfc, or OnRequestEnd.cfm file"
After some digging around, it appears that there's no real way to handle this within the application itself--or at least no way that I've found thus far.
Are there any decent solutions for this problem out there?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案是通过 ColdFusion Administrator 使用全局错误处理程序:
在这里,您将输入值您构建的 cf 模板的一部分,并捕获由于直接访问 Application.cfc 而出现的必要错误。
The answer is to use the global error handler via ColdFusion Administrator:
Here, you'll enter in the value of a cf template that you build, and trap the necessary errors that come in as a result of direct access to Application.cfc.
好吧,如果您不想使用站点范围的错误处理程序,您可以简单地使 Application.cfc 不可通过 Web 浏览,然后让您的 404 处理程序处理它。
Well, if you don't want to use the site-wide error handler, you could simply make the Application.cfc not web browseable, then let your 404-handler deal with it.