Как запустить команду curl из WebAPI? - PullRequest
0 голосов
/ 23 января 2020

Этот проект находится в Azure. Следующий код возвращает «ИСКЛЮЧЕНИЕ: система не может найти указанный файл».

Где находится файл curl в Azure? или Как я могу выполнить curl -v -k --key keyfile.key --cert certfile.crt:'passphrase' https://server1.com/sms

try
{
    using (Process pProcess = new Process())
    {
        pProcess.StartInfo.FileName = @ExtCurl;
        pProcess.StartInfo.Arguments = ArgumentFull;
        pProcess.StartInfo.UseShellExecute = false;
        pProcess.StartInfo.RedirectStandardOutput = true;
        pProcess.StartInfo.RedirectStandardError = true;
        pProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        pProcess.StartInfo.CreateNoWindow = true;
        pProcess.Start();

        string output = pProcess.StandardOutput.ReadToEnd();
        string error = pProcess.StandardError.ReadToEnd();

        pProcess.WaitForExit();

        if (error.Length > 0)
            return "ERROR: " + error;
        else
            return output;
    }
}
catch (Exception e)
{
    return "EXCEPTION: " + e.Message;
}
...