mysql - 如何在没有 CFadmin 访问权限的情况下远程调试 Coldfusion AJAX 应用程序?

标签 mysql ajax debugging coldfusion

我必须从远程访问点调试 Ajax Coldfusion8 应用程序,并且正在努力让任何东西正常工作。

系统在我的本地主机上运行良好,但在生产服务器上,我一无所获,页面加载正常,但所有 Ajax 请求都会被遗忘(提交错误),而不会触发 Coldfusion 错误。

我的 AJAX 设置如下:

1).设置

$(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 = 
        function ( form, service, formdata, targetUrl, successHandler, dataHandler ){
          $.ajax({  async: false, type: "post", 
                    url: service, data: formdata, dataType: "json",
             success: function( objResponse ){
            if (objResponse.SUCCESS){
              alert("success!");
              successHandler( objResponse )
              }
        })
    }
    
  2. 服务器端
    在服务器端,我有一个“主从”cfc 设置。有类型 cfcs(用户,无论什么),它们是主 form_switch 的扩展,如下所示:

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

THIS.mappings["/controllers"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "controllers";
THIS.mappings["/serve"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "services";

cfc 类型扩展为 form_switch

// user cfc
<cfcomponent extends="controllers.form_switch" output="false"> 
...
</cfcomponent>

form_switch 本身执行所有基本操作,例如验证和调用 type.cfc 中的数据库提交。看起来像这样:

<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 并尝试了

 <cfdump output="F:\full\path\to_root\dump.txt" label="catch" var="hello"> 

但这给了我一封带有

的 505 错误电子邮件
 Diagnose: An error occurred when performing a file operation write on file F:\full\path\to_root\dump.txt

我无法使用 CF admin AJAX 调试,因为我无权从远程访问 CFAdmin。

我还能做什么?另外,如果有人知道问题可能是什么...也欢迎回答...必须是基本的东西,比如困惑的映射或在服务器上没有某种用户权限...我认为?

谢谢!

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

编辑:
好的。我必须使用 e:\和 E:\从 application.cfc 写入 dump.txt。但从 form_switch 仍然不起作用。

最佳答案

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

使用 cfabort 将 cfdump 粘贴到 catch 中。

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

这应该为您提供方法的结果或错误转储

关于mysql - 如何在没有 CFadmin 访问权限的情况下远程调试 Coldfusion AJAX 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11366477/

相关文章:

php - 从 MySQL 查询构建多维 PHP 数组

mysql - 如何计算股票百分比变化值的变化

javascript - jquery ajax超时最佳实践值

PHP 从 MySQL 填充值

javascript - 使用 AJAX 设置间隔

javascript - 通过AJAX获取POST数据

iphone - 有效的 Xcode 调试

javascript - 如何在 IE9 中跟踪冲突?

node.js - 使用 node-inspector 调试 Node/Express RESTful API

android - 相关对象中带有 LIKE 子句的 GreenDao 查询