我正在構建一個項目,允許用戶將視頻上傳到服務器,服務器將以特定格式對視頻進行編碼。上傳完成後,應執行vbs腳本來完成我需要的操作。獲取一個程序在IIS服務器上執行c#
雖然我在獲取腳本在服務器上運行的確很困難。當在服務器本身的VS2012中進行調試時,我可以很好地工作。但是,當我部署它並運行相同的代碼時,它不起作用。
我試着退後一步,我試圖讓任何程序來執行,但它不工作。這裏是我的代碼,我正在嘗試打開記事本文件上傳後:
//file is saved
try
{
ProcessStartInfo psi = new ProcessStartInfo(@"C:\Windows\System32\notepad.exe");
Process proc = new Process();
proc.StartInfo = psi;
proc.StartInfo.FileName = @"C:\Windows\System32\notepad.exe";
bool didItStart = proc.Start();
}
catch(Exception ex)
{
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\test\log.txt"))
{
file.WriteLine(ex.InnerException + " " + ex);
}
}
這不拋出任何錯誤,沒有數據被寫入日誌文件。什麼都沒發生。我搜索了一段時間,發現並嘗試了一堆沒有奏效的東西,包括impersonation,更改了腳本所在文件夾的權限,並且changing the permission of the folder the scripts are in to include the IIS user沒有任何工作。
爲什麼不能正常工作?
你有沒有試過這個[http://forums.asp.net/t/1277084.aspx](http://forums.asp.net/t/1277084.aspx) – Zilog
你有沒有讀過這個? http://stackoverflow.com/questions/4679561/system-diagnostics-process-start-not-work-fom-an-iis –
在任務管理器中,您是否看到「notepad.exe」進程被創建?程序不會在用戶會話中啓動,因此您不會看到窗口出現。 – David