我想通过 Azure 函数执行依赖于 DLL 的 C++ .exe。它适用于我的本地机器以及使用 kudo 控制台启动 exe 时。
就像在Azure Function中的 Post Run .exe 可执行文件中一样,建议我准备好 run.csx 并将 .exe 和 DLL 加载到同一文件夹“D:\home\site\wwwroot\QueueTriggerCSharp1\”中。
它在不需要 C++ 代码中的 DLL 时起作用。否则 C++ 找不到 DLL(与 .exe 位于同一文件夹中)并且退出代码为 -1073741701。如果我不上传 DLL,我会得到相同的退出代码。
我应该在哪里加载 DLL 或者还有其他原因吗?
run.csx 代码:
using System;
using System.Threading;
using System.Diagnostics;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
string WorkingDirectoryInfo =@"D:\home\site\wwwroot\QueueTriggerCSharp1\";
string ExeLocation = @"D:\home\site\wwwroot\QueueTriggerCSharp1\WriteDatebase2.exe";
Process proc = new Process();
ProcessStartInfo info = new ProcessStartInfo();
info.WorkingDirectory …Run Code Online (Sandbox Code Playgroud)