如何在不重置服务器实例的情况下重置 application.cfc? [英] How do I reset application.cfc without resetting the server instance?

查看:14
本文介绍了如何在不重置服务器实例的情况下重置 application.cfc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
重启应用而不重启服务器?

如何在不重置 Coldfusion 服务器实例的情况下重置 Coldfusion 应用程序/application.cfc?如果我没记错的话,有一些技巧,比如在 application.cfc 中创建一个 reinit 函数或重命名文件.

How do I reset a Coldfusion Application / application.cfc without resetting the Coldfusion Server instance? If I remember right, there are a few tricks out there such as creating a reinit function within application.cfc or renaming the file.

推荐答案

几个步骤:

首先,确保所有应用程序初始化逻辑都包含在 CFC 的 OnApplicationStart 方法中.如果它有嵌套调用,那很好 - 只要您可以通过一次调用轻松地重新初始化您的应用程序,您的生活就会变得更加轻松.

First, make sure all your application initialization logic is contained inside the OnApplicationStart method of your CFC. If it has nested calls, that is fine - just so long as you can re-initialize your application easily through a single call makes your life much easier.

其次,这是我在application.cfc的OnRequestStart方法中使用的代码

Second, this is the code I use in the OnRequestStart method of application.cfc

<cfif structKeyExists(url,'resetappvars')>
  <cfset OnApplicationStart() />
</cfif>

随意使用任何您想要的编码值来代替 resetAppVars.

Feel free to use whatever coded value you would like in place of resetAppVars.

这篇关于如何在不重置服务器实例的情况下重置 application.cfc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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