首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在没有CFadmin访问的情况下远程调试Coldfusion应用程序?

如何在没有CFadmin访问的情况下远程调试Coldfusion应用程序?
EN

Stack Overflow用户
提问于 2012-07-06 16:53:34
回答 2查看 513关注 0票数 2

我必须从远程访问点调试Ajax Coldfusion8应用程序,并且很难完成任何工作。

系统在本地主机上运行得很好,但是在生产服务器上,我没有任何地方可以加载页面,但是所有Ajax请求都会被遗忘(提交错误)而不会触发Cold聚变错误。

我的AJAX设置如下:

1)。设置

代码语言:javascript
复制
$(document).on( "click", '.su, .cu' , function() {      
     var form = $(this).closest('form'),
         switcher = form.find('input[name="form_sub"]').val(),
         service = "../serve/form_user.cfc",
         method = "process",
         returnformat = "JSON",
         targetUrl = "",
         formdata = form.serialize()+"&method="+method+"&returnformat="+returnformat,
         successHandler = function() {
              alert("hello")
              };
    ajaxFormSubmit( form, service, formdata, targetUrl, successHandler, "no" );
    return false;
    });
  1. 发出AJAX调用 var ajaxFormSubmit =函数(表单、服务、格式数据、targetUrl、successHandler、dataHandler ){ $.ajax({异步: false,类型:"post",url: service,data: formdata,dataType:"json",dataType: function( objResponse ){ if (objResponse.SUCCESS){ $.ajax(“success!”);successHandler( objResponse )} }) }
  2. 服务器端 在服务器端,我有一个“主从”cfc设置。有类型-cfcs(用户,随便什么),它们是一个主要form_switch的扩展,如下所示:

这两个文件都是从application.cfc映射的,如下所示:

代码语言:javascript
复制
THIS.mappings["/controllers"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "controllers";
THIS.mappings["/serve"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "services";

类型cfc扩展到form_switch。

代码语言:javascript
复制
// user cfc
<cfcomponent extends="controllers.form_switch" output="false"> 
...
</cfcomponent>

form_switch本身完成了type.cfc中的所有基本工作,如验证和调用数据库提交。看起来是这样的:

代码语言:javascript
复制
<cfcomponent output="false" hint="switchboard for form handling">
...
   // function called by AJAX
   <cffunction name="Process" access="remote" returntype="struct" output="false">

       <cfset var LOCAL = {} />
       <cfset LOCAL.Response = { Success = true, Errors = [], Data = "" } />

       // set form data
       <cfif IsStruct( ARGUMENTS[ 1 ] )>
           <cfset THIS.SetFormData( ARGUMENTS[ 1 ] ) />
       <cfelse>
           <cfset THIS.SetFormData( ARGUMENTS ) />
       </cfif>

       // validate
       <cfset LOCAL.Response.Errors = THIS.Validate() />

       // commit
       <cfif ArrayLen( LOCAL.Response.Errors )>
           <cfset LOCAL.Response.Success = false />
           <cfset LOCAL.Response.Errors = serializeJSON(LOCAL.Response.Errors)>
       <cfelse>
           <cftry>               
           <cfset LOCAL.Response = THIS.Commit() />
           <cfcatch>
                  <cfset LOCAL.Response.Success = false />
                  <cfset LOCAL.Response.Errors = [["server_error","commit error"]] />
           </cfcatch>
           </cftry> 
       </cfif>
      <cfreturn LOCAL.Response />
   </cffunction>
</cfcomponent>

我不知道为什么它不起作用,更糟糕的是,我猜是盲目的,为什么?

ajax返回“提交错误”,所以我将访问*form_switch*。

问题:,我如何调试这个?

我试过:

转储到屏幕>不工作,因为我使用的是AJAX。

将文件转储到文件(我有服务器的完整路径,我可以访问服务器,所以我设置了一个dump.txt并尝试

代码语言:javascript
复制
 <cfdump output="F:\full\path\to_root\dump.txt" label="catch" var="hello"> 

但这给了我一封505错误的电子邮件

代码语言:javascript
复制
 Diagnose: An error occurred when performing a file operation write on file F:\full\path\to_root\dump.txt

我不能使用CFAdmin调试,因为我无法从远程访问CFAdmin。

我还能做什么?而且如果有人知道问题出在哪里..。答案也是欢迎的..。必须是一些基本的东西,比如混乱的映射,或者在服务器上没有某种用户隐私,...I假设?

谢谢!

是Coldfusion8和MySql 5.0.88 .生产是MySQL 5.5,但我认为这是另一个问题。

编辑

好的。我必须使用e:\和E:\从application.cfc写到application.cfc。但是它仍然不能从form_switch中运行。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-07-06 18:16:15

您是否尝试过在浏览器中直接调用cfc方法,使用url参数,而不是使用AJAX中的post?

在渔获物中插入一个cfdump。

像这样叫你的cfc:http://yourdomain.com/serve/forms users.cfc?method=process&arg1=qwe&arg2=963

这将给出方法的结果或错误的转储。

票数 3
EN

Stack Overflow用户

发布于 2012-07-06 17:11:12

基本问题确实..。

代码语言:javascript
复制
 E:\ != e:\
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11366477

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档