![](/img/trans.png)
[英]Running cscript.exe from C# .ashx does not execute code in vbscript file
[英]Email Cron issue with jscript and cscript.exe
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:在本地主机上运行我的Visual Studio项目
步骤2:打开命令提示符
第三步:运行以下命令
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 ';'
请指导我缺少的地方,我正在寻找它并在此处发布。
我已找到问题的解决方案,并且工作正常。
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动机已经实现,但我仍然感到困惑,为什么它对Project无效,因为它在网站模板中有效。 然后,我安排了cscript.exe在Windows Task Scheduler中运行此.js文件。
请评论并指导我们为什么它不起作用,并且它在同一项目中起作用,但在另一个项目中却起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.