【问题标题】:Email Cron issue with jscript and cscript.exejscript 和 cscript.exe 的电子邮件 Cron 问题
【发布时间】:2014-04-01 13:48:06
【问题描述】:
var strURLs= new Array("http:// localhost: 51611/Cron/Email.aspx");
var webObj = WScript.CreateObject("MSXML2.ServerXMLHTTP");

var lResolve = 10 * 1000;
var lConnect = 10 * 1000;
var lSend = 60000 * 1000;
var lReceive = 60000 * 1000;

webObj.setTimeouts(lResolve, lConnect, lSend, lReceive);

for (var i = 0; i < strURLs.length; i++) {
    webObj.open("GET", strURLs[i], false);
    try {
        webObj.send();
        if (webObj.status != 200 || String(webObj.statusText).match(/Database is currently unavailable/gi) != null) {

        }
    }
    catch (e) {
    }
}

我正在执行以下步骤:
第 1 步:在 localhost
运行我的 Visual Studio 项目 Step2:打开命令提示符
Step3:运行以下命令
C:\Windows\System32>cscript.exe "D:\Projects\Cron\CronScript.js"

我在在线验证器 JLint 上检查了代码
删除整个 if 条件后

编译时我仍然收到错误

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

D:\Projects\Cron\CronScript.js(1, 8) Microsoft JScript compilation error: Expected ';' 

请指导我在哪里缺少我正在寻找很长时间并在这里发布。

【问题讨论】:

    标签: asp.net cron jscript wsh


    【解决方案1】:

    我得到了问题的解决方案,并且工作正常。

    Well I am using Visual Studio 2010 Project for my web application.   
    So when I create any new page it contains 3 files Default.aspx, Default.aspx.cs,   
    Default.aspx.designer.cs   
    But when I choose New Website then I get only Default.aspx and Default.aspx.cs.
    

    上面提到的相同 Cron 代码(javascript)对我的一位同事工作正常,他正在使用 Visual Studio 2010 网站。

    I copied the same file(without the designer.cs file) with the same code in-fact same letter,      
        and add in my project and it worked.
    

    好吧,我的 Cron 动机已经完成,但我仍然很困惑为什么它在项目中对我不起作用,因为它在网站模板中起作用。 然后我安排 cscript.exe 在 Windows 任务计划程序中运行这个 .js 文件。

    请评论并指导我们为什么它不工作并且它在同一个项目中工作但在不同的项目中工作。

    【讨论】:

      猜你喜欢
      • 2010-10-29
      • 1970-01-01
      • 1970-01-01
      • 2014-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-22
      • 2011-05-19
      相关资源
      最近更新 更多