【问题标题】:Azure App Service - run custom executableAzure 应用服务 - 运行自定义可执行文件
【发布时间】:2019-12-13 18:46:36
【问题描述】:
我有一个 .NET Core 2.2 Web 应用程序,该解决方案中的一个功能是调用第 3 方 .exe 来完成一些工作
`ProcessStartInfo psi = new ProcessStartInfo(path_to_custom_exe_file, command_here)`
是否可以在 Azure 应用服务中执行此操作,或者我应该考虑另一种选择?
【问题讨论】:
标签:
azure
azure-app-service-plans
azure-app-service-envrmnt
【解决方案1】:
是的,只要您的 exe 文件没有 GUI,您就可以在 Azure Web 中调用可执行文件。
我用下面的代码调用一个 cmd 文件:
var processStartInfo = new ProcessStartInfo()
{
FileName = @"D:\home\test.cmd",
RedirectStandardOutput = true,
UseShellExecute = false
};
var process = Process.Start(processStartInfo);
var streamReader = new StreamReader(process.StandardOutput.BaseStream);
ViewData["Message"] = streamReader.ReadToEnd(); ;
return View();