/// <summary>
///
/// </summary>
/// <returns></returns>
public Process OpenProcess()
{
if (IsExist())
return _curProcess;
_curProcess = new Process();
try
{
_curProcess.StartInfo.FileName = _processPath;
_curProcess.Start();
}
catch
{
_curProcess.Kill();
return null;
}
return _curProcess;
}
/// <summary>
///
/// </summary>
public void Kill()
{
if (_curProcess != null)
_curProcess.Kill();
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public bool IsExist()
{
Process[] processArr = Process.GetProcesses();
foreach (Process p in processArr)
{
if (p.ProcessName == _processName)
{
_curProcess = p;
return true;
}
}
return false;
}
執行.exe
Process p = new Guage().OpenProcess();
p.Start()
爲什麽本地運行都Ok,但將代碼轉移到服務器再訪問執行exe,服務器上不會運行,相應的權限我都開放了,但是就是不會運行,我換成WebService來調用相應的代碼再執行exe還是不運行,不知道是什麼原因,有哪位大俠知道怎麼解決的請告訴我一下,謝謝了!