0
我有以下方法:asp.net運行腳本
protected void RunWSFScript()
{
try
{
System.Diagnostics.Process scriptProc = new System.Diagnostics.Process();
scriptProc.StartInfo.FileName = @"cscript";
scriptProc.StartInfo.Arguments = "\\\\server\\folder\\script.wsf \\\\server\\folder\\"
+ file + ".xml";
scriptProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; //prevent console window from popping up
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
string message = @"Please verify output.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
catch
{
string message = "An error has occured. Please try again.";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
}
我遇到的問題是,該腳本正確執行,當我在本地運行調試時,但之後,我已經把網站上的那個方法iis服務器不再執行,我也沒有收到任何錯誤。
可能是什麼問題?
謝謝。是的,我知道錯誤處理還遠遠沒有完成,我只是想讓腳本先執行然後移到那個腳本上。基本上每個人都通過NTLM登錄到網站,並且每個人都可以完全控制文件夾/文件,所以我還應該檢查什麼? – user1468537 2012-07-10 06:46:54
已經嘗試了上面的內容,並且當它到達這一行''''''''''''''''''''''''或'string error = scriptProc.StandardError.ReadToEnd();'' – user1468537 2012-07-10 07:28:07
不知道錯誤是什麼正面臨的是你在黑暗中拍攝。這就是爲什麼你需要在嘗試修復你的bug之前讓你的錯誤處理得到修復。 ReadToEnd()調用拋出什麼錯誤? – 2012-07-10 07:43:27